-
Notifications
You must be signed in to change notification settings - Fork 0
test(ci): LAB-1151 negative proof 2 — job neutering, DO NOT MERGE #70
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
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 |
|---|---|---|
|
|
@@ -93,6 +93,11 @@ jobs: | |
| # This job never pushes; don't leave the token on a self-hosted | ||
| # runner workspace (zizmor: artipacked). | ||
| persist-credentials: false | ||
| # Depth 2 so the tamper check below can diff HEAD^1 (the base tip | ||
| # the merge commit was computed against) without a live network | ||
| # fetch — a live base tip drifts under queued re-runs and would | ||
| # red-flag innocent PRs for gate changes that landed on main. | ||
| fetch-depth: 2 | ||
|
|
||
| - name: cargo deny (advisories + bans + licenses + sources) | ||
| # --all-features is load-bearing, not tidiness. cargo-deny builds a | ||
|
|
@@ -107,7 +112,7 @@ jobs: | |
| # silently regenerate Cargo.lock when Cargo.toml has drifted. Without | ||
| # this, deny grades an uncommitted graph while audit grades the | ||
| # committed one. | ||
| run: cargo deny --locked --all-features check | ||
| run: cargo deny --locked check | ||
|
|
||
| - name: cargo audit (lockfile advisories) | ||
| # Complements cargo deny rather than duplicating it — see the table in | ||
|
|
@@ -126,3 +131,43 @@ jobs: | |
| # Runs even when the step above failed so one run shows both verdicts. | ||
| if: ${{ !cancelled() }} | ||
| run: cargo audit | ||
|
|
||
| - name: Gate tamper check (deny.toml / security.yml vs base) | ||
| # This job reads its own policy (deny.toml) and its own definition | ||
| # (this file) from the PR head, so the PR being gated can weaken the | ||
| # gate while keeping the required `supply-chain` context green — drop | ||
| # --all-features, append `|| true`, or delete the [bans] entries the | ||
| # command faithfully enforces (LAB-1151). Outright deletion fails | ||
| # closed (a required context that never reports blocks merge, with no | ||
| # bypass actors on ruleset 17788230) — UNLESS the PR ships a | ||
| # replacement check with the same name, which is why the second diff | ||
| # below also trips on any other changed workflow file that mentions | ||
| # supply-chain. This step makes modification fail closed: gate-file | ||
| # diffs turn this required check red without the approval marker in | ||
| # the PR body (see README "Gate tamper-evidence" for the marker and | ||
| # for what this deliberately does not defend against). | ||
| # | ||
| # HEAD is the PR merge commit, so HEAD^1 is the base tip it was | ||
| # computed against — exact PR effect, no network, no base-drift | ||
| # false positives (checkout fetch-depth: 2 makes it resolvable). | ||
| # PR_BODY enters via env only and is matched by grep as data; it is | ||
| # never interpolated into this shell. | ||
| if: ${{ github.event_name == 'pull_request' && !cancelled() }} | ||
| env: | ||
| PR_BODY: ${{ github.event.pull_request.body }} | ||
| run: | | ||
| set -o pipefail | ||
| changed=$(git diff --name-only HEAD^1 HEAD -- deny.toml .github/workflows/security.yml | tr '\n' ' ') | ||
|
Comment on lines
+159
to
+160
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. WHAT: set -o pipefail
git rev-parse -q --verify HEAD^1 >/dev/null || { echo "::error title=Gate tamper check::cannot resolve PR base (HEAD^1) — failing closed"; exit 1; }
changed=$(git diff --name-only HEAD^1 HEAD -- deny.toml .github/workflows/security.yml | tr '\n' ' ') || { echo "::error title=Gate tamper check::git diff failed — failing closed"; exit 1; }Prompt for LLMTalk to Kody by mentioning @kody Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction. |
||
| shadow="" | ||
| while IFS= read -r f; do | ||
| [ -n "$f" ] || continue | ||
| if git grep -qe supply-chain HEAD -- "$f"; then shadow="$shadow$f "; fi | ||
| done < <(git diff --name-only HEAD^1 HEAD -- '.github/workflows/' ':!.github/workflows/security.yml') | ||
| if [ -z "$changed$shadow" ]; then | ||
| echo "Gate files unchanged vs PR base." | ||
| elif grep -qF -- '[gate-change-approved]' <<<"$PR_BODY"; then | ||
| echo "::warning title=Supply-chain gate files changed::${changed}${shadow}differ from the PR base; approval marker present in PR body — confirm the human sign-off in review." | ||
| else | ||
| echo "::error title=Supply-chain gate tampering::This PR changes ${changed}${shadow}— files that define this gate. If intentional: get human sign-off, add the approval marker documented in README section 'Gate tamper-evidence' to the PR body, then push a commit (empty is fine — body edits alone do not re-trigger, and re-runs reuse the old event payload)." | ||
| exit 1 | ||
| fi | ||
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Restore all-feature dependency checks.
Line 115 checks only the default feature set. A banned crate introduced behind an optional feature can now pass the required
supply-chaincheck. Restore--all-featuresso CI enforces the policy documented indeny.tomland README.md.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents