Skip to content

chore: add gitleaks workflow and mock secret for testing#6

Closed
duongtronghoa6a-debug wants to merge 2 commits into
devfrom
feature/setup-gitleaks
Closed

chore: add gitleaks workflow and mock secret for testing#6
duongtronghoa6a-debug wants to merge 2 commits into
devfrom
feature/setup-gitleaks

Conversation

@duongtronghoa6a-debug

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated secret scanning on pull requests using Gitleaks, and introduces a sample “mock secret” file intended to validate detection behavior.

Changes:

  • Add a new GitHub Actions workflow to run Gitleaks on PRs targeting main and dev
  • Add mock-secret.txt containing an AWS-key-like value for testing secret detection

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
mock-secret.txt Adds a mock credential-like string intended to trigger Gitleaks.
.github/workflows/gitleaks.yml Introduces a PR-triggered Gitleaks scanning workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mock-secret.txt Outdated
@@ -0,0 +1,2 @@
# Dòng này cố tình chứa secret giả để test Gitleaks trong quá trình làm đồ án
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This committed file contains a string matching an AWS Access Key ID pattern. Even if it’s intentionally fake, it will be flagged by Gitleaks and also normalizes committing credential-like material into the repo. Prefer generating this test secret during the workflow run (or using a non-matching placeholder), and keep real-looking secrets out of version control.

Suggested change
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_ACCESS_KEY_ID=TEST_ACCESS_KEY_PLACEHOLDER

Copilot uses AI. Check for mistakes.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow runs gitleaks without referencing the repo’s existing gitleaks.toml / .gitleaksignore configuration, so allowlisted paths won’t be applied and results may differ from the existing nightly scan. Consider passing the config/ignore via the action inputs (or args) to ensure consistent findings across workflows.

Suggested change
- uses: gitleaks/gitleaks-action@v2
- uses: gitleaks/gitleaks-action@v2
with:
args: --config=.gitleaks.toml --gitleaks-ignore-path=.gitleaksignore

Copilot uses AI. Check for mistakes.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With fetch-depth: 0 and no explicit “no-git/diff-only” mode, this is likely to scan full git history on every PR, which can be significantly slower and may surface unrelated historical findings. If the intent is to scan just the working tree for the PR, configure gitleaks accordingly and keep the checkout shallow to reduce runtime.

Suggested change
fetch-depth: 0
fetch-depth: 1

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants