Skip to content

ci: qualify.yml attaches a qualified run's evidence to the tag's release (060 3.7.3, workflow) - #489

Merged
bartekus merged 1 commit into
mainfrom
impl/060-qualify-workflow
Nov 4, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/060-qualify-workflow

Conversation

@bartekus

@bartekus bartekus commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Spec 060 increment 2b (3.7.3, workflow): qualify.yml attaches a qualified run's evidence to the tag's release. Workflow-only; the tooling is #487 (this PR is stacked on it).

  • record: after rustev-release qualify writes the record, it packs each platform's qualify-<platform> artifact unchanged into qualification-vX.Y.Z-<platform>.tar.gz (GNU tar, fixed order, mtime 0, owner 0, gzip -n), copies the record to qualification-vX.Y.Z.json, and uploads both as the artifact qualification-assets. The job exposes qualified=true only after a record is written.
  • attach (new): runs only when record recorded qualified; the workflow's only job with contents: write. It checks out the workflow's own commit (so a dispatch can attach evidence for a tag released before this change) and runs rustev-release attach-qualification "$TAG" <assets>, which uploads only names not yet present and never replaces one.
  • release.yml: the qualify call now grants contents: write as the ceiling of qualify.yml's jobs; only attach takes it. github-release stays the only job of release.yml itself that writes contents. No job gains packages: write.

Needs the owner's statecraft-review-exception approval (workflow change).

Checks: actionlint on both workflows passed; cargo test -p rustev-release --locked --test release_workflow passed (including qualify_reads_and_only_attach_may_write_contents from #487); make gate passed.

Review notes (round 1):

  • Permission ceiling: qualify.yml has a top-level permissions: block (contents: read, attestations: read) that jobs without their own block inherit, so the caller's contents: write was already only a ceiling. To make it explicit anyway, qualify and record now declare their read permissions at job level; only attach declares contents: write.
  • Tag validation in record: its first step (unchanged, outside the diff) is "The tag is a stable release tag, checked before any checkout", the same ^v<major>.<minor>.<patch>$ check attach runs, so $TAG is validated before any file is written.

Round 3: this PR now also carries the workflow-permission tests that check it, moved from #487. qualify_reads_and_only_attach_may_write_contents (tests/release_workflow.rs) and the relaxed workflow_write_permissions_are_confined (tests/candidate.rs, which skips comment lines and admits the qualify call) both pass here.

@bartekus bartekus added the statecraft:stacked-ci Run the full CI matrix on a stacked pull request label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the three changed files for bugs, security problems, and inconsistencies.

qualify.yml — permission ceiling leak

release.yml changes the calling job's ceiling from contents: read to contents: write. In GitHub Actions reusable workflows, every job in the called file inherits the caller's ceiling unless it declares a tighter permissions block. The diff adds permissions: contents: write only to the new attach job. The existing record job (and any other jobs in qualify.yml that do not appear in the diff) have no explicit permissions block, so after this PR they silently inherit contents: write rather than the former contents: read ceiling. The stated design and the spec 060 3.7.3 annotation both say "only attach takes contents: write," but that claim is now architectural intent rather than a hard enforcement: the record job's GH_TOKEN has write-to-release permission available to it.

qualify.yml — tag format validated in attach but not in record

The attach job validates $TAG against the semver pattern before proceeding. The record job uses $TAG to construct archive filenames in a shell loop (> "assets/qualification-$TAG-$platform.tar.gz") without prior validation. If TAG contains path-separator characters (e.g. v1.0.0/../../../tmp/x), the redirect target escapes the assets/ directory on the runner. In practice the control flow partially mitigates this — gh release view with an invalid tag name will fail and set -eu will abort the step before qualified=true is written, preventing the packing step from running — but the guard is indirect. Moving the tag-format check to the top of the record job (before any file operations) would make the protection explicit and consistent with attach.

No other concrete defects found (spec frontmatter, action SHA pins, if-no-files-found handling, and the qualified output gating all look correct).

{"head": "50c6a32531fd952ee33c3bec1aba2ae0909e238c", "verdict": "findings", "findings": [{"path": ".github/workflows/release.yml", "line": 890, "summary": "Raising the calling-job ceiling from `contents: read` to `contents: write` grants that permission to all jobs in qualify.yml that lack an explicit `permissions` block (e.g. `record`), contradicting spec 060 3.7.3's design that only `attach` holds `contents: write`."}, {"path": ".github/workflows/qualify.yml", "line": 220, "summary": "The `record` job constructs archive filenames using `$TAG` before the tag is validated, allowing a path-traversal destination on the runner if `TAG` contains `/`; the semver check that guards against this only runs in the later `attach` job."}]}

Subject: d8e4f21...50c6a32, diff digest a3551a35a8c9cab7ab0a07175047d01362f3be1333f8061e163ceef1e1c22686, 1 call(s). An AI comment is not an approval.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the three changed files for bugs, security problems, and inconsistencies.

qualify.yml — record job: $TAG used in filename construction before any format validation

The record job writes filenames like "assets/qualification-$TAG.json" and "assets/qualification-$TAG-$platform.tar.gz" using the unvalidated inputs.tag value. The regex guard (^v<major>.<minor>.<patch>$) lives only in the attach job, which runs after record has already finished constructing and uploading the asset artifact. If TAG contains a path separator (e.g., v1/0.0), the shell redirect > "assets/qualification-$TAG-…" would attempt to write outside assets/; set -eu would then abort the script, leaving a failed record job and no assets to attach — a silent failure that surfaces only late. The fix is to run the same regex check at the top of record's packaging step (or share a reusable step), consistent with how attach guards its own use of $TAG.

qualify.yml — for d in bundles/qualify-* without nullglob

If the artifact download step produces an empty bundles/ directory (e.g., the action silently succeeds with zero matches), bash expands the unmatched glob to the literal string bundles/qualify-*, causing platform=* and a tar invocation that immediately fails under set -eu. The result is another unexplained job failure rather than a clear diagnostic. Using shopt -s nullglob or an explicit guard would make the empty-match case explicit.

No other substantive issues found. The contents: write ceiling in release.yml is correctly scoped — qualify and record both declare explicit contents: read, so the wider caller permission never reaches them, and only attach can write. The idempotency claim (attach-qualification uploads only names not yet present) is consistent between the spec text and the workflow comment. Action references are hash-pinned. The spec ratification text (A-76) is pre-existing in the base and not introduced by this PR.

{"head": "5060792fa590b01299d23c9345cc9cafb79abded", "verdict": "findings", "findings": [{"path": ".github/workflows/qualify.yml", "line": null, "summary": "The `record` job constructs filenames using `$TAG` (e.g., `\"assets/qualification-$TAG.json\"`) before any format validation; the regex guard that enforces `v<major>.<minor>.<patch>` exists only in the downstream `attach` job, so a tag containing a path separator would cause a silent mid-job failure rather than an early, clear rejection."}, {"path": ".github/workflows/qualify.yml", "line": null, "summary": "The `for d in bundles/qualify-*` loop in `record` lacks `nullglob` protection, so an empty-download edge case produces a literal-glob `d` and an opaque `tar` failure under `set -eu` rather than a diagnostic no-op."}]}

Subject: d8e4f21...5060792, diff digest 147658559747c432a1172a0b977b78d938b54a89b90ac586f86488fc471261ad, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 3, 2026 21:51 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/060-qualify-assets branch from d8e4f21 to 07a048c Compare November 3, 2026 21:51
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from 5060792 to 04c01a3 Compare November 3, 2026 21:52
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the three changed files for bugs, security issues, and inconsistencies.

qualify.yml — qualify matrix job: Explicit permissions: contents: read and attestations: read added. This correctly narrows the caller's wider ceiling (contents: write) so the matrix jobs cannot write. Sound.

qualify.yml — record job:

  • permissions: contents: read explicit (no attestations: read). Before this PR the job inherited attestations: read from the caller; now it won't have it. The rustev-release qualify release evidence command runs here. If it only aggregates evidence already verified by the matrix jobs (which do have attestations: read), this is fine by design. No contradiction is visible in the diff.
  • outputs: qualified: ${{ steps.record.outputs.qualified }} and id: record added correctly.
  • echo "qualified=true" is only reached past the publication.json guard and after a successful rustev-release qualify invocation. The absent-publication early-exit leaves the output unset (empty string ≠ 'true'), so the downstream attach condition correctly short-circuits. Logic is sound.
  • for d in bundles/qualify-* with set -eu: if the download-artifact step silently produces no subdirectories the glob is unexpanded and tar would fail, aborting the step. This is acceptable defensive behaviour; the step is only reached when qualified=true, meaning all matrix jobs succeeded and their artifacts exist.
  • Tarball reproducibility flags (--sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner, gzip -n) are correct.

qualify.yml — attach job:

  • permissions: contents: write only. Correct — it only uploads assets.
  • Tag regex ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ is a correct semver guard before any write.
  • Checks out the workflow's own commit (not the release tag) so attach-qualification is always available even for older tags. Intentional per comment.
  • attach-qualification "$TAG" "$RUNNER_TEMP/assets" — $TAG is already validated above; $RUNNER_TEMP is a trusted runner-provided path. No injection risk.

release.yml: Caller permissions raised to contents: write with a correct comment explaining only attach takes it. The statement "the only job of this file that writes contents" for github-release remains accurate because attach lives in qualify.yml. Internally consistent.

spec.md: The increment 2b narrative matches the implementation; ratification claim (A-76) is in contributor-controlled data and enforced elsewhere.

No concrete defect found.

{"head": "04c01a32b668def9825d29f5c3b939b20c6511c4", "verdict": "no-findings", "findings": []}

Subject: 07a048c...04c01a3, diff digest 6e5371eca55fefa6ef8ce31b448fed1709905b889018269ccad8b716db885a2a, 1 call(s). An AI comment is not an approval.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the three changed files for bugs, security problems, and inconsistencies.

.github/workflows/qualify.yml

The permissions layering is correct: the caller (release.yml) now grants contents: write as a ceiling, but qualify restricts to contents: read, attestations: read and record restricts to contents: read. Only attach takes contents: write. All three jobs declare permissions explicitly, so the wider ceiling does not silently reach the read-only jobs.

The tag validation in attach runs before any release write; the gh release view "$TAG" check in record provides implicit protection against malformed tags before the filename-construction steps, since an invalid or absent tag causes the pipeline to exit at the grep -qx publication.json guard (exit 0). $TAG is double-quoted throughout, preventing word-splitting. The for d in bundles/qualify-* loop is not nullglob-guarded, but if no artifacts match and qualify == 'true', the subsequent tar call would fail under set -eu, which is appropriate behavior.

The echo "qualified=true" output is emitted only after rustev-release qualify exits 0 (enforced by set -eu), so the absent-output path (attach skipping) correctly handles tool failure.

The actions/checkout in attach without an explicit ref checks out github.sha. For a workflow_dispatch, this is the default-branch HEAD carrying attach-qualification. For a release triggered by a tag push (after this PR merges), github.sha is the tag's commit, which also carries the command. The comment accurately describes the dispatch scenario.

.github/workflows/release.yml

The comment update from "the only job that writes contents" to "the only job of this file that writes contents" is accurate, since qualify.yml's attach now also writes contents. The permission change from contents: read to contents: write on the qualify call is required to allow attach to operate; the explicit per-job restrictions in qualify.yml ensure the write permission is confined.

specs/060-the-service-image-in-the-release/spec.md

The increment 2b narrative accurately describes the code: record packs per-platform artifacts, attach is the sole contents: write job, and the asset upload is idempotent (names not yet present only). The acknowledgement of the deviation from spec 058 3.3.3 and the owner's acceptance is documented inline, consistent with governance practice.

No concrete defects found.

{"head": "73b64c626ef54ef300d7d0c431c17e40209d7abe", "verdict": "no-findings", "findings": []}

Subject: 07a048c...73b64c6, diff digest f27ed70a10863003e3e11a20249049e97dc0835773ac3af37d42a657e058d03b, 1 call(s). An AI comment is not an approval.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the changes to the qualification workflow, the spec, and the accompanying tests.

qualify.yml — record job uses $TAG in file paths before validation

The attach job validates the tag format with a semver regex (^v(...)\.(...)\.(...)\$) before running attach-qualification. However, the record job, which runs before attach, embeds $TAG directly in file paths without any prior validation:

cp qualification.json "assets/qualification-$TAG.json"
# ...
gzip -n > "assets/qualification-$TAG-$platform.tar.gz"

If qualify.yml is hand-dispatched with a malformed TAG (e.g., containing .. or other unexpected characters), the record job builds paths from an unvalidated value. With set -eu and double-quoted expansions, shell injection is not a risk, but cp qualification.json "assets/qualification-../evil.json" would write to a parent directory on the runner. The files remain on the ephemeral runner and are uploaded as GitHub Actions artifacts; the release itself is protected because attach validates the tag and exits early. The impact is confined to the runner, but the guard is on the wrong job. The fix is to add the same regex check at the top of the record job's "bundle" step (or move the existing check into a shared record step that runs first).

Everything else looks correct:

  • The contents: write ceiling in release.yml's qualify call is properly confined by explicit contents: read on qualify and record jobs in qualify.yml; only attach holds contents: write. This matches the GitHub Actions permission scoping model.
  • The attach job tag validation regex is correct and covers the write path.
  • The qualify_reads_and_only_attach_may_write_contents test correctly enforces the invariant.
  • The workflow_write_permissions_are_confined comment-skipping fix in candidate.rs is a genuine correctness improvement (a comment containing contents: write would previously have triggered the assertion).
  • Artifact pinning by SHA is consistent with the rest of the file.
  • The only_github_release_writes_contents_and_nothing_writes_packages skip of the qualify job correctly delegates to the cross-file test.
{"head": "fa3cc1dde5f13ad44e062e9655294495b36cd579", "verdict": "findings", "findings": [{"path": ".github/workflows/qualify.yml", "line": 220, "summary": "The `record` job embeds `$TAG` in file paths before the tag is validated; the semver check only occurs in the downstream `attach` job, so a hand-dispatched run with a malformed tag can create oddly-named local files and artifacts before `attach` fails."}]}

Subject: 0fbcf1e...fa3cc1d, diff digest 5e6d638ec8d3dcf26be0d3f2b4ca412506644134ed8cd3e5972a73afc5b6389a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 3, 2026 23:23 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-qualify-assets branch from 0fbcf1e to eea7676 Compare November 4, 2026 00:31
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from fa3cc1d to 43e0bb6 Compare November 4, 2026 00:31
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for bugs, security issues, and inconsistencies in the qualify.yml workflow changes, the new attach job, permission scoping, spec text, and test updates.

qualify.yml — permission scoping

The qualify and record jobs now declare explicit contents: read (and attestations: read), and the new attach job is the sole holder of contents: write. GitHub Actions job-level permissions override the workflow-level ceiling from release.yml's caller, so the ceiling contents: write from release.yml's qualify call correctly reaches only attach. Design is sound.

qualify.yml — echo "qualified=true" placement

set -eu at the top of the record step causes the shell to exit immediately if cargo run ... qualify ... fails, so echo "qualified=true" is never reached on error. The early-exit path (exit 0 when publication.json is absent) leaves qualified unset, which is correct. The logic depends on the binary exiting 0 iff it records a qualified state; this is consistent with the spec's intent but not independently verifiable from the diff.

attach job — tag validation

The printf '%s\n' "$TAG" | grep -Eq '^v...' pattern is injection-safe (the tag is not interpolated into the regex) and correctly rejects pre-release and build-metadata suffixes. Validation runs before checkout and before any write operation.

attach job — artifact flow

record correctly gates the artifact pack/upload steps on steps.record.outputs.qualified == 'true', and attach correctly depends on needs: record with if: needs.record.outputs.qualified == 'true'. Artifact names follow a deterministic pattern (qualification-$TAG.json, qualification-$TAG-$platform.tar.gz) with fixed tar options (--sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner), satisfying the reproducibility requirement.

release.yml — comment in test

The updated workflow_write_permissions_are_confined test in candidate.rs skips comment lines before checking for contents: write. The release.yml comments added in this PR do contain the string contents: write; without the skip they would have been attributed to whichever job was current at that point, corrupting the writes vector. The fix is correct.

release_workflow.rs — qualify_reads_and_only_attach_may_write_contents

split_once("\npermissions:\n") matches only an unindented permissions: key (job-level keys are four-space indented, so they appear as \n permissions:\n), correctly finding the workflow-level block. split_once("\n\n") to find the end of the block is fragile if the YAML has no trailing blank line after the top-level permissions: section, but since the test uses .unwrap() and is introduced here, the file must already satisfy this layout. No defect in evidence.

Spec text

The spec records owner acceptance (A-76, 2026-11-03) of the reading that contents: write added here applies only to qualify.yml's attach job. This is consistent with the stated governance process.

No concrete defect is supported by the evidence in the diff.

{"head": "43e0bb6bc4e05594dadf68ac48a4389069b4968a", "verdict": "no-findings", "findings": []}

Subject: eea7676...43e0bb6, diff digest 5e6d638ec8d3dcf26be0d3f2b4ca412506644134ed8cd3e5972a73afc5b6389a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 00:48 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-qualify-assets branch from eea7676 to ede2d79 Compare November 4, 2026 02:38
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from 43e0bb6 to ad8f1df Compare November 4, 2026 02:39
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

Looking at the diff, I'll review each changed file for bugs, security problems, and inconsistencies.

.github/workflows/qualify.yml - record job permissions

The qualify job gets explicit permissions: contents: read with the comment "Explicit, so a caller's wider ceiling never reaches this job." The record job does not get the same treatment — it has no explicit permissions block and relies on the workflow-level default. This contradicts what the spec says.

specs/060-the-service-image-in-the-release/spec.md - spec/code discrepancy

The increment 2b text states: "qualify and record declare their read permissions explicitly, so the wider ceiling never reaches them." Only qualify has an explicit job-level permissions block in the diff; record does not. The safety rationale given ("explicit declaration prevents the wider ceiling from reaching the job") therefore does not apply to record as described.

.github/workflows/qualify.yml - unconditional qualified=true output

In the record job's run step, echo "qualified=true" >> "$GITHUB_OUTPUT" fires whenever the cargo run … qualify command exits 0, with no inspection of the JSON output. The spec says "a run that recorded qualified" keeps its evidence — implying the tool can also produce a non-qualified outcome at exit 0. If rustev-release qualify writes a non-qualified JSON but exits 0, the attach job is triggered incorrectly.

Other observations (no finding):

  • release.yml comment update and permission ceiling change are internally consistent.
  • candidate.rs test fix (skipping comment lines) is correct and necessary.
  • release_workflow.rs new test qualify_reads_and_only_attach_may_write_contents correctly verifies both the top-level permissions and that only attach holds contents: write.
  • The tag regex in attach correctly validates semver format; the same validation is absent in record but the attack surface is limited (a valid GitHub release must exist first).
{"head": "ad8f1dfac1cef7abe95e35afd0ccdc032b13e53c", "verdict": "findings", "findings": [{"path": "specs/060-the-service-image-in-the-release/spec.md", "line": null, "summary": "Increment 2b claims both `qualify` and `record` declare their read permissions explicitly, but the diff only adds an explicit `permissions` block to the `qualify` job; `record` has none and relies on workflow-level defaults, so the stated safety rationale does not apply to it."}, {"path": ".github/workflows/qualify.yml", "line": null, "summary": "The `record` job has no explicit `permissions` block, contradicting the spec's claim and leaving it unprotected by the defensive explicit-declaration pattern used for `qualify` and `attach`."}, {"path": ".github/workflows/qualify.yml", "line": null, "summary": "`echo \"qualified=true\" >> \"$GITHUB_OUTPUT\"` runs whenever the `cargo run … qualify` command exits 0 without inspecting the JSON result; if the tool exits 0 for a non-qualified outcome the `attach` job fires incorrectly and uploads assets for an unqualified release."}]}

Subject: ede2d79...ad8f1df, diff digest 8272e9c085c83f810abf3198edadf58e0bcb5653d4fb72b55f4cbb5a972ad0cf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 4, 2026 02:43 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which adds a new attach job to qualify.yml that uploads qualification assets to a release, with associated spec documentation and test coverage.

qualify.yml

  • Job-level permissions are set explicitly on qualify (contents: read, attestations: read) and record (contents: read), so the contents: write ceiling from release.yml's caller never reaches them. Only attach holds contents: write. This is correct per 060 3.7.3.
  • The record step sets echo "qualified=true" >> "$GITHUB_OUTPUT" only on the success path. If the early-exit branch fires (no publication.json) the output is empty, so attach does not run. If rustev-release qualify fails under set -eu, the step errors and attach is skipped by dependency. Both are correct.
  • The tag validation regex in attach ('^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$') runs before checkout and is guarded via printf '%s\n', so no injection risk.
  • The attach job downloads the qualification-assets artifact created by record; the sequencing is correct.
  • The reproducible tar flags (--sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner, -n for gzip) are correct.

release.yml

  • The qualify call's permission ceiling is raised from contents: read to contents: write to allow attach. The comment and test both confirm only attach takes it. The comment change clarifying "github-release stays the only job of this file that writes contents" is accurate.

Tests

  • candidate.rs: Skipping #-prefixed lines before scanning for contents: write correctly prevents the new descriptive comment in release.yml from triggering a false positive. The allowed-writers set ["github-release"] or ["github-release", "qualify"] is correct.
  • release_workflow.rs → qualify_reads_and_only_attach_may_write_contents: The split on "\npermissions:\n" (no indentation) correctly targets the top-level permissions: block; job-level permissions: entries are indented and would not match. The assertion that only attach holds contents: write among qualify.yml's jobs is correctly enforced.

No concrete defects found.

{"head": "ad8f1dfac1cef7abe95e35afd0ccdc032b13e53c", "verdict": "no-findings", "findings": []}

Subject: ede2d79...ad8f1df, diff digest 8272e9c085c83f810abf3198edadf58e0bcb5653d4fb72b55f4cbb5a972ad0cf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 04:37 — with GitHub Actions Error
Base automatically changed from impl/060-qualify-assets to main November 4, 2026 05:21
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from ad8f1df to ca65fbb Compare November 4, 2026 05:22
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across all five changed paths.

qualify.yml — job permissions and new attach job

  • qualify and record jobs now declare explicit job-level permissions: blocks (contents: read). This is correct: even though release.yml raises the ceiling to contents: write, job-level permissions cap each job independently.
  • The record job sets qualified=true only after cargo run … qualify succeeds, so the early-exit path (exit 0 when no publication.json) leaves the output empty, correctly preventing attach from running.
  • The attach job validates $TAG against a strict semver regex before any write, ensuring the filename and release-asset target cannot contain path-traversal or shell metacharacters.
  • Deterministic packing (--sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner) is consistent with spec 060's intent for reproducible evidence archives.
  • If the record job fails after qualified=true is written (e.g., the packing step errors), GitHub Actions does not propagate job outputs from failed jobs, so attach is correctly skipped.

release.yml — qualify call permissions change

The comment-only change to the description of github-release and the upgrade of the qualify call from contents: read to contents: write are consistent with the design that the ceiling is passed through to qualify.yml while only attach consumes it.

specs/060…/spec.md

The increment description accurately matches the workflow changes and records the owner's acceptance of the deviation from spec 058 3.3.3.

candidate.rs — workflow_write_permissions_are_confined

The addition of line.trim_start().starts_with('#') { continue; } correctly suppresses false positives from the new comment lines in release.yml that contain the string contents: write. The final assertion allowing ["github-release"] or ["github-release", "qualify"] correctly spans both the pre- and post-PR states and would fail if any other job acquired the permission.

release_workflow.rs — qualify_reads_and_only_attach_may_write_contents

The two-part test structure is correct: (1) the top-level parse asserts the workflow-level ceiling, and (2) the job-iteration loop enforces that no job other than attach holds contents: write. The qualify_writers() helper used in both the new and existing tests is consistent.

No concrete defects found.

{"head": "ca65fbbc9e35f33563331943ad23cfb8011717a4", "verdict": "no-findings", "findings": []}

Subject: c2389cd...ca65fbb, diff digest 8272e9c085c83f810abf3198edadf58e0bcb5653d4fb72b55f4cbb5a972ad0cf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 05:31 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from ca65fbb to 3002f43 Compare November 4, 2026 07:15
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for bugs, security issues, and inconsistencies.

Permission isolation design: The core mechanism — qualify and record jobs in qualify.yml explicitly declare contents: read, preventing the contents: write ceiling granted by release.yml's qualify call from reaching them — is correct. In GitHub Actions, explicit job-level permissions override the caller's ceiling.

Tag validation in attach: The regex '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' correctly enforces stable semver (no pre-release suffix) before any write occurs.

Artifact download in attach: The actions/download-artifact v4+ uses ACTIONS_RUNTIME_TOKEN (not GITHUB_TOKEN) for same-run artifact downloads, so the absence of actions: read in attach's permissions is fine.

workflow_write_permissions_are_confined test change: Skipping comment lines is necessary because the new comment block at lines ~55–57 of release.yml contains the substring contents: write literally. Without the skip, the comment would have been counted as a writer. The skip is correct and targeted.

qualify_reads_and_only_attach_may_write_contents parsing: The split_once("\npermissions:\n") correctly targets the zero-indented workflow-level block (job-level blocks are indented 4 spaces as \n permissions:\n) and panics on unwrap if the top-level block is absent, which is a good failure mode.

qualified output gate: echo "qualified=true" >> "$GITHUB_OUTPUT" runs only if cargo run -- qualify exits zero (enforced by set -eu). An empty/missing output correctly causes attach's if: condition to be false, skipping the write job.

Tarball construction: --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner with gzip -n produces reproducible archives. The for d in bundles/qualify-* loop over artifact subdirectories is consistent with how actions/download-artifact v4+ places artifacts at <path>/<artifact-name>/.

qualify_writers() double-checking: The function is called from both only_github_release_writes_contents_and_nothing_writes_packages (checks attach is present) and qualify_reads_and_only_attach_may_write_contents (checks ONLY attach is present), providing complete coverage.

No concrete defects found.

{"head": "3002f43713acb121603da68158194dc85bfa7e05", "verdict": "no-findings", "findings": []}

Subject: b4b19e8...3002f43, diff digest d567fb81cc4fea8aca1b6002c7046f92ecf07d5b3c9a112bfbfe8698b0d005e9, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 07:20 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from 3002f43 to 71f0105 Compare November 4, 2026 09:23
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff for bugs, security issues, and inconsistencies.

qualify.yml – record job uses $TAG in file paths before any format validation

The bundle-packing step in record constructs output filenames using $TAG:

cp qualification.json "assets/qualification-$TAG.json"
...
gzip -n > "assets/qualification-$TAG-$platform.tar.gz"

$TAG comes from inputs.tag, which is user-supplied for workflow_dispatch triggers. The tag format is not validated here. The validation only happens later, as the first step of the attach job:

printf '%s\n' "$TAG" | grep -Eq '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' \
  || { echo "qualify: tag must be v<major>.<minor>.<patch>" >&2; exit 2; }

If $TAG contains ../ sequences (e.g. ../../foo), the cp and redirection in record write files outside the assets/ directory. The subsequent actions/upload-artifact with if-no-files-found: error would then fail because no files land in assets/, preventing attach from running — but the errant write already occurred on the runner. The attach job is correctly guarded, but record is not. The validation should be applied to $TAG at the start of record's shell script, before the filename construction, mirroring attach.

No other concrete defects found. The permission scoping (top-level read ceiling, job-level contents: write isolated to attach, and the contents: write ceiling passed from release.yml), the test updates in candidate.rs and release_workflow.rs, and the spec text all appear internally consistent.

{"head": "71f01052c00227e2171dfb4f199501e079113bc2", "verdict": "findings", "findings": [{"path": ".github/workflows/qualify.yml", "line": 229, "summary": "The record job constructs file paths using $TAG before validating its format; tag validation only occurs in the attach job, allowing path traversal via adversarial workflow_dispatch inputs."}]}

Subject: 294c40d...71f0105, diff digest d19ec4372568283946f3557a70366e705138dc9f2516d1e86e6092106797bbaf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 4, 2026 09:28 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Review note on 71f0105: the $TAG finding is a false positive. Every job of qualify.yml that reads inputs.tag, including record, checks it against ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ as its first step (line 183 for record), before any checkout or path built from it, and fails the job otherwise. No change.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
@bartekus
bartekus force-pushed the impl/060-qualify-workflow branch from 71f0105 to eb7073b Compare November 4, 2026 10:51
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across all five changed files for bugs, security issues, and inconsistencies.

qualify.yml – new attach job and permission hardening

The job-level permissions: contents: read on qualify and record correctly narrows those jobs' scope when release.yml passes contents: write as a ceiling. The attach job tag regex (^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$) is correct for strict semver without pre-release suffixes. $TAG and $platform are always double-quoted in shell expansions. $TAG is set via env: (not ${{ inputs.tag }} interpolated inline), so it is passed as a data value and cannot inject shell syntax. The --locked flag on cargo run pins dependencies.

release.yml – ceiling lift from read to write

Comment updates accurately reflect the new state. The qualify job's new contents: write is documented as a ceiling; the existing managed-file and CODEOWNERS constraints govern whether this workflow edit required owner approval (outside the diff).

candidate.rs – test update

The comment-skip (line.trim_start().starts_with('#')) is necessary because the new comment block in release.yml contains the literal text contents: write. Without it the test would falsely count that comment line. The relaxed assertion (writes == ["github-release"] || writes == ["github-release", "qualify"]) is order-sensitive and consistent with job ordering in the file.

release_workflow.rs – new test and cross-file check

qualify_reads_and_only_attach_may_write_contents checks (a) the top-level permissions: block of qualify.yml equals ["contents: read", "attestations: read"] and (b) no job besides attach holds any write permission. The split_once("\npermissions:\n") pattern correctly targets the top-level block (zero indentation) and would .unwrap()-panic if that block is absent, which CI would surface. The qualify_writers() cross-file consistency check in only_github_release_writes_contents_and_nothing_writes_packages is sound.

spec.md – governance text

The increment documents the owner ratification date and the accepted reading of spec 058's contents: write confinement. No inconsistency with the diff.

No concrete defects found.

{"head": "eb7073ba2f0c8ab6f745628513df8cf39626cb43", "verdict": "no-findings", "findings": []}

Subject: 185713b...eb7073b, diff digest e8debcf38c67c41ebfcb3ee9051b861b67770406c2f029d1cc2d909ee0423b2a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 4, 2026 10:57 — with GitHub Actions Inactive
@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit b8a8cd8 Nov 4, 2026
38 checks passed
@bartekus
bartekus deleted the impl/060-qualify-workflow branch November 4, 2026 12:17

This branch was previously deployed

1 inactive deployment
statecraft-review-exception — eb7073ba Deployed Nov 4, 2026 by bartekus via review-exception #3337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

statecraft:stacked-ci Run the full CI matrix on a stacked pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant