-
Notifications
You must be signed in to change notification settings - Fork 27
chore(build): add gitleaks secret scanning workflow #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Gitleaks | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| gitleaks: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: gitleaks/gitleaks-action@v2 | ||
|
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/gitleaks.ymlRepository: questdb/c-questdb-client Length of output: 568 🌐 Web query:
💡 Result: Best practice: pin GitHub Actions to a full commit SHA
Why this is recommendedGitHub recommends SHA pinning to proactively limit the impact of a compromised dependency in workflows. [5] Sources Citations:
Pin action refs to full commit SHAs. Both steps are using movable tags, and the 🔒 Suggested hardening- - uses: actions/checkout@v4
+ - uses: actions/checkout@<verified-full-length-commit-sha> # v4
with:
fetch-depth: 0
- - uses: gitleaks/gitleaks-action@v2
+ - uses: gitleaks/gitleaks-action@<verified-full-length-commit-sha> # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}🤖 Prompt for AI Agents |
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Read the gitleaks workflow file to understand its full structure cat -n .github/workflows/gitleaks.ymlRepository: questdb/c-questdb-client
Length of output: 568
🌐 Web query:
gitleaks-action v2 GITLEAKS_LICENSE requirement💡 Result:
For
gitleaks/gitleaks-action@v2,GITLEAKS_LICENSEis only required when scanning repositories owned by a GitHub Organization account; it’s not required for repos under a personal (user) account. [1]You obtain a (free) license key from
gitleaks.io, store it as an encrypted GitHub Actions secret (repo- or org-level), and pass it to the action asGITLEAKS_LICENSE. [1]Note: the action validates the key via a third-party licensing service (“keygen”) and sends the license key plus repo owner/name for validation. [1]
🌐 Web query:
GitHub Actions secrets fork pull request workflow💡 Result:
Default behavior (safe by default): Workflows triggered by
pull_requestfrom forks run with a read-onlyGITHUB_TOKENand no access to repository secrets (org/repo/environment secrets). This is to prevent secret exfiltration by untrusted code in fork PRs. [1], [2], [3]Repo setting: “Require approval” (controls whether the workflow runs at all, not secret access): Public repos can be configured so fork-PR workflows don’t run automatically and require approval depending on contributor status (“Approval for running fork pull request workflows from contributors”). Even when approved, fork-PR runs still don’t get secrets under the default security model. [3], [4]
Repo/org setting: “Send secrets and variables to workflows from fork pull requests” (high risk): If you enable this, fork PR workflows may receive secrets—which is dangerous unless you fully trust/verify the code path, because a fork can modify workflow behavior to exfiltrate secrets. (GitHub explicitly highlights fork PRs as a security concern.) [3]
pull_request_target(powerful but commonly misused):pull_request_targetruns in the context of the base repo and can access secrets; GitHub and GitHub Security Lab warn it has increased risk with fork PRs if you execute attacker-controlled PR code (the “pwn request” class of issues). Prefer not to use it unless you know the secure patterns. [5], [6]Common secure pattern:
pull_requestwithout secrets.pushtomain, or a carefully designedworkflow_run), so secrets are never exposed to untrusted PR code. [4], [6]Sources:
[1] GitHub Docs – “Understanding GitHub secret types” (fork PRs don’t receive Actions secrets) (docs.github.com)
[2] GitHub Blog – “GitHub Actions improvements for fork and pull request workflows” (read-only token, no secrets for fork PRs) (github.blog)
[3] GitHub Docs – “Managing GitHub Actions settings for a repository” (fork PR workflow settings) (docs.github.com)
[4] GitHub Blog – “4 tips to keep your GitHub Actions workflows secure” (fork PRs: no secrets, read-only token) (github.blog)
[5] GitHub Changelog (2025-11-07) –
pull_request_targetrisk/secret exposure considerations (github.blog)[6] GitHub Security Lab – “Preventing pwn requests” (
pull_request_targetpitfalls) (securitylab.github.com)Citations:
Fork PRs will fail because
GITLEAKS_LICENSEis unavailable.This workflow runs on
pull_request(including forks) but unconditionally referencesGITLEAKS_LICENSEin the environment. GitHub Actions does not pass repository secrets to fork-triggered PR workflows by default, so external contributor PRs will fail. Sincegitleaks-action@v2requiresGITLEAKS_LICENSEfor organization repositories, consider guarding the licensed scan behind a condition that skips external PRs, or add a separate non-secret fallback scan path for forks.🤖 Prompt for AI Agents