Skip to content

Feature/setup gitleaks#7

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

Feature/setup gitleaks#7
duongtronghoa6a-debug wants to merge 4 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:27

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 a pull-request Gitleaks scan workflow (in addition to the existing nightly scan) and includes a sample “mock secret” file intended to exercise detection.

Changes:

  • Added mock-secret.txt containing a token-like string for testing Gitleaks detection.
  • Added .github/workflows/gitleaks.yml to run Gitleaks on pull requests targeting main and dev.

Reviewed changes

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

File Description
mock-secret.txt Introduces a test secret-like value (currently problematic to keep in-repo).
.github/workflows/gitleaks.yml Adds PR-time Gitleaks scanning via gitleaks/gitleaks-action@v2.

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

Comment thread mock-secret.txt Outdated
Comment on lines +1 to +4
# Dòng này cố tình chứa secret giả để test Gitleaks trong quá trình làm đồ án
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDE
-----END PRIVATE KEY-----

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 file commits a GitHub PAT-looking token string (ghp_...). Even if intended as a mock, it can trigger GitHub secret scanning / token revocation workflows and will cause the new Gitleaks job to fail, blocking merges. Replace it with a clearly non-secret placeholder (that does not match real token formats), or keep test fixtures outside the repo/CI scan via an allowlist entry (e.g., gitleaks.toml allowlist path) rather than committing a token-like value.

Suggested change
# Dòng này cố tình chứa secret giả để test Gitleaks trong quá trình làm đồ án
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDE
-----END PRIVATE KEY-----
# Dòng này dùng placeholder không phải secret thật để test Gitleaks trong quá trình làm đồ án
MOCK_PRIVATE_KEY_PLACEHOLDER_FOR_TESTING_ONLY
NOT_A_REAL_KEY_OR_CREDENTIAL
END_MOCK_PRIVATE_KEY_PLACEHOLDER

Copilot uses AI. Check for mistakes.
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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 PR introduces a PR-time Gitleaks workflow, but it doesn’t use the repo’s existing gitleaks.toml configuration / allowlist (the nightly workflow runs detect with --config=/work/gitleaks.toml). As a result, PR scans may produce different findings than nightly runs (including false positives or misses). Configure this action to run with the same config/ignore setup as the existing nightly job so results are consistent.

Suggested change
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_CONFIG: ${{ github.workspace }}/gitleaks.toml

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +19
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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 uses gitleaks/gitleaks-action@v2, which may run a different Gitleaks engine version than the nightly scan (currently pinned to zricethezav/gitleaks:v8.18.4). That can lead to inconsistent detections between PR and nightly runs. Consider pinning the underlying Gitleaks version (or switching both workflows to the same invocation method) to keep behavior stable and comparable over time.

Suggested change
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Gitleaks
run: |
docker run --rm \
-v "${{ github.workspace }}:/repo" \
-w /repo \
zricethezav/gitleaks:v8.18.4 \
git --no-banner

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