Repository navigation
feat: bounded secret scanner with real controls and staged estate rollout #62
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
025b5de
feat: add bounded secret scanner and evidence-driven canary controls
hyperpolymath 291b9ce
ci: canary suite secret scanner while retaining legacy coverage compa…
hyperpolymath 50dc27f
fix: enforce HTTPS-only scanner downloads and record live canary evid…
hyperpolymath 5b07970
ci: repin canary to HTTPS-hardened scanner
hyperpolymath 6be7f35
docs: clarify secret scan cleanup and PR CI helper behavior
coderabbitai[bot] d34cd65
fix: use trusted base configs for PR secret scans and handle absent b…
coderabbitai[bot] 80dc01b
Merge remote scanner documentation changes
coderabbitai[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Canary safety: retained for Rust/shell coverage comparison; not scan / gitleaks. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # Prevention workflow - scans for hardcoded secrets before they reach main. | ||
| # | ||
| # Calls the estate's shared secret scanner (gitleaks + rust-secrets + | ||
| # shell-secrets). The job key MUST stay `scan`: the estate-wide | ||
| # Secret-Scan-Floor ruleset requires the check context `scan / gitleaks`. | ||
| # | ||
| # No `secrets:` line, deliberately: the reusable references no secrets | ||
| # (gitleaks runs as a checksum-verified binary, not gitleaks-action), so | ||
| # `secrets: inherit` would only hand it every repo and org secret (CWE-250). | ||
| name: Legacy secret scanner (coverage comparison) | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| legacy: | ||
| uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@74d2f66f575246cf6e313ae7775f44df6e097ff2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # Single required context remains scan / gitleaks in direct callers. | ||
| name: Bounded secret scanner (reusable) | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| fast-pr: | ||
| description: Security-owner-approved introduced-commit PR scan; non-PR runs always scan full history | ||
| type: boolean | ||
| default: false | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| gitleaks: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| steps: | ||
| - name: Check out subject and complete ancestry | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| path: subject | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Resolve exact suite pin from the direct scan caller | ||
| id: suite | ||
| env: | ||
| CALLER_REF: ${{ github.workflow_ref }} | ||
| CALLER_REPO: ${{ github.repository }} | ||
| run: | | ||
| set -euo pipefail | ||
| file="${CALLER_REF#"$CALLER_REPO"/}"; file="${file%@*}" | ||
| case "$file" in .github/workflows/*.yml|.github/workflows/*.yaml) ;; *) exit 2 ;; esac | ||
| ref=$(yq -r '.jobs.scan.uses' "subject/$file") | ||
| prefix=hyperpolymath/cicd-suite/.github/workflows/secret-scanner-reusable.yml@ | ||
| [[ $ref == "$prefix"* ]] || { echo '::error::requires a direct scan caller'; exit 2; } | ||
| sha=${ref#"$prefix"} | ||
| [[ $sha =~ ^[0-9a-f]{40}$ ]] || { echo '::error::caller must pin a full SHA'; exit 2; } | ||
| echo "sha=$sha" >> "$GITHUB_OUTPUT" | ||
| - name: Check out pinned scanner implementation outside subject | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: hyperpolymath/cicd-suite | ||
| ref: ${{ steps.suite.outputs.sha }} | ||
| path: suite | ||
| persist-credentials: false | ||
| - name: Verify pinned checkout and install checksum-pinned Gitleaks | ||
| env: | ||
| EXPECTED: ${{ steps.suite.outputs.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| [[ $(git -C suite rev-parse HEAD) == "$EXPECTED" ]] || exit 2 | ||
| bash suite/actions/secret-scan-check/install.sh "$RUNNER_TEMP/suite-gitleaks" | ||
| - name: Run real detector controls before trusting the scan | ||
| env: | ||
| GITLEAKS_BIN: ${{ runner.temp }}/suite-gitleaks/gitleaks | ||
| run: bash suite/actions/secret-scan-check/control.sh | ||
| - name: Scan subject (bounded, redacted, both populations) | ||
| env: | ||
| GITLEAKS_BIN: ${{ runner.temp }}/suite-gitleaks/gitleaks | ||
| SUBJECT: ${{ github.workspace }}/subject | ||
| ESTATE_BASELINE: ${{ github.workspace }}/suite/config/gitleaks/estate-baseline.toml | ||
| FAST_PR: ${{ inputs.fast-pr }} | ||
| EVENT: ${{ github.event_name }} | ||
| PR_BASE: ${{ github.event.pull_request.base.sha }} | ||
| PR_HEAD: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| export SCAN_MODE=full SCAN_TIMEOUT_SECONDS=180 | ||
| if [[ "$EVENT" == pull_request && "$FAST_PR" == true ]]; then | ||
| export SCAN_MODE=pr-range HEAD_SHA="$PR_HEAD" | ||
| # A PR may be behind the base tip: scan from their common ancestor, | ||
| # not from the final file diff and not from a guessed depth. | ||
| export BASE_SHA | ||
| BASE_SHA=$(git -C "$SUBJECT" merge-base "$PR_BASE" "$PR_HEAD") | ||
| fi | ||
| bash suite/actions/secret-scan-check/check.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| name: Bounded secret scanner controls | ||
| on: | ||
| push: | ||
| pull_request: | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: secret-controls-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| controls: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Shell and YAML syntax | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| for f in actions/secret-scan-check/*.sh; do bash -n "$f"; done | ||
| yq '.' .github/workflows/secret-scanner-reusable.yml >/dev/null | ||
| yq '.' templates/secret-scanner-caller.yml >/dev/null | ||
| yq '.' actions/secret-scan-check/action.yml >/dev/null | ||
| - name: Shell/control-flow fixtures and vacuous-scanner mutant | ||
| run: bash actions/secret-scan-check/test.sh | ||
| - name: Install the pinned real scanner | ||
| run: bash actions/secret-scan-check/install.sh "$RUNNER_TEMP/suite-gitleaks" | ||
| - name: Repeat fixtures against the real detector (not a stand-in) | ||
| env: | ||
| GITLEAKS_BIN: ${{ runner.temp }}/suite-gitleaks/gitleaks | ||
| run: bash actions/secret-scan-check/test.sh | ||
| - name: Evidence collector controls | ||
| run: bash tests/inspect-pr-ci.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,23 @@ | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # Prevention workflow - scans for hardcoded secrets before they reach main. | ||
| # | ||
| # Calls the estate's shared secret scanner (gitleaks + rust-secrets + | ||
| # shell-secrets). The job key MUST stay `scan`: the estate-wide | ||
| # Secret-Scan-Floor ruleset requires the check context `scan / gitleaks`. | ||
| # | ||
| # No `secrets:` line, deliberately: the reusable references no secrets | ||
| # (gitleaks runs as a checksum-verified binary, not gitleaks-action), so | ||
| # `secrets: inherit` would only hand it every repo and org secret (CWE-250). | ||
| # Keep scan / gitleaks: required by the estate Secret-Scan-Floor ruleset. | ||
| name: Secret Scanner | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| schedule: | ||
| - cron: '23 3 * * 2' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| # Scheduled/full audits and PR cancellation do not cancel one another. | ||
| group: secrets-${{ github.event_name }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| scan: | ||
| uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@74d2f66f575246cf6e313ae7775f44df6e097ff2 | ||
| uses: hyperpolymath/cicd-suite/.github/workflows/secret-scanner-reusable.yml@50dc27f47e39f7ac046596c071ed4ea80b4989e0 | ||
| with: | ||
| # Keep false until an initial full audit passes and the security owner | ||
| # accepts introduced-commit PR coverage. All non-PR runs remain full. | ||
| fast-pr: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| name: Bounded secret scan | ||
| description: Redacted tree and history scan with pinned Gitleaks, live controls and explicit infrastructure failure | ||
| inputs: | ||
| path: | ||
| description: Complete subject repository checkout (no shallow history) | ||
| default: '.' | ||
| mode: | ||
| description: full (default) or security-owner-approved pr-range | ||
| default: full | ||
| base-sha: | ||
| description: Verified ancestor commit for pr-range | ||
| default: '' | ||
| head-sha: | ||
| description: Expected checked-out head commit for pr-range | ||
| default: '' | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Install and execute the bounded scanner | ||
| shell: bash | ||
| env: | ||
| ACTION_DIR: ${{ github.action_path }} | ||
| SUBJECT: ${{ inputs.path }} | ||
| SCAN_MODE: ${{ inputs.mode }} | ||
| BASE_SHA: ${{ inputs.base-sha }} | ||
| HEAD_SHA: ${{ inputs.head-sha }} | ||
| PR_BASE: ${{ github.event.pull_request.base.sha }} | ||
| PR_HEAD: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| bash "$ACTION_DIR/install.sh" "$RUNNER_TEMP/suite-gitleaks" | ||
| export GITLEAKS_BIN="$RUNNER_TEMP/suite-gitleaks/gitleaks" | ||
| export ESTATE_BASELINE="$ACTION_DIR/../../config/gitleaks/estate-baseline.toml" | ||
| bash "$ACTION_DIR/check.sh" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.