Repository navigation
ci(security): read Claude secrets only from the main-only claude-lanes environment - #17516
Conversation
…s environment
Every job that reads a Claude API key or Claude Code OAuth token now
names environment {name: claude-lanes, deployment: false}. The
environment's branch policy admits main alone, so a workflow file
changed on another branch can never reach a secret stored there. Until
the environment holds its own copies the jobs read the organization
secrets of the same names, so nothing changes at merge.
- 49 jobs in 17 workflows gain the environment. The reusable
pr-run-activity-read.yml and maintenance-measure-skill-edit-pass.yml
carry it on their own jobs, since a calling job cannot set one.
- PR Run Plugin Evals moves its label trigger from pull_request to
pull_request_target, so main's copy of the file runs; the head stays
a checkout of the plugin under test. check-trusted-trigger judges a
pull_request_target payload as it judges pull_request.
- check-read-caller-keys admits {name: claude-lanes, deployment: false}
on any job of a read run.
- New Lint Repo gate scripts/check-claude-secrets-environment.sh fails
a job that reads a Claude secret outside the environment, and a job
in it that a pull_request, merge_group or off-main push run starts.
The three jobs calling ci-workflows reusables wait in PENDING_REMOTE.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
…nment - lane-funding.json names pull_request_target and the same-repo gate for the three PR Run Plugin Evals legs. - callers.test.mjs recognizes the evals gate: an either-or whose every branch is a dispatch or holds the head repository, carried to a leg through a needed job's success or an output only its run sets, with paired cases. - pr-merge-risk/workflow.test.mjs expects the environment block after each leg's if. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review (blocking only, because this lane already reviewed head I read every hunk of all 36 changed files in What I checked
critical-findings: 0 |
|
claude-review reviewed Code review: ci(security): read Claude secrets only from the main-only
|
…est_target GitHub blocks pull_request_target in public repositories from 2026-12-02 unless an Actions event policy allows it, and allowing it loosens an org control. The eval: run label now runs the secret-free pr-record-eval-label.yml; its completion starts the eval legs on workflow_run from main, in the claude-lanes environment. The recorder run is the head's copy, so the legs read nothing it wrote. check-trusted-trigger resolves the pull request from the run's head on its existing workflow_run path, and check-label-sender.sh reads the draft state and a labeled eval: run event by the triggering listed human, within ten minutes before the run, from the API. The head checked out as the plugin under test is the run's head_sha. check-trusted-trigger's pull_request_target branch is reverted, since nothing uses it now. The docs record why a renamed pass-through of an environment secret works, with run 44613075678 as production evidence. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
…abel naming-lint rejected pr-record-eval-label.yml: `record` is not a function word allowed for stage `pr`. The recorder now carries the function word of the workflow it starts, with `name: PR Run Plugin Evals Label` and the matching workflow_run filter, sender check, test and docs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
Brings in main's changes to the workflow files this branch also edits, so the stale-base-overlap check passes and a squash cannot revert them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
ci-workflows#1154 gave the intake-triage and pr-review-cli reusables an environment input. Intake Triage starts on issues and main dispatches, so its caller passes environment: claude-lanes now and leaves PENDING_REMOTE. The guard accepts a remote call whose with: environment is the literal claude-lanes and holds it to the same head-trigger rule as a job, so a pull_request caller that passes it fails in CI, not at the environment. The two hosted review callers stay pending until #17537. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
…ract runner-policy failed the caller: the standards contract for ci-workflows intake-triage.yml does not list the environment input yet, and that file is vendored from melodic-software/standards. Intake Triage goes back into PENDING_REMOTE until the contract allows it; the guard keeps accepting a literal with: environment: claude-lanes on a remote call. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
Every pr-unblock dispatch since #17516 has failed at startup: "Error from called workflow .../pr-run-activity-write.yml: Maximum object size exceeded". pr-unblock expands pr-run-activity-read.yml 15 times, so the claude-lanes environment blocks #17516 added (about 2KB once expanded) pushed it over. pr-run-activity-read.yml drops its workflow_call input, output and secret descriptions (10KB parsed, about 150KB across pr-unblock's 15 calls). GitHub parses them into the expanded workflow, and nothing reads them at run time: the file parses to its old object minus the descriptions. Git history keeps the text. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj # Conflicts: # .github/workflows/pr-run-activity-read.yml
…review-cli (#1082) Closes #1076 ## Summary Lists `environment` in `allowedInputs` for `melodic-software/ci-workflows/.github/workflows/intake-triage.yml` and `melodic-software/ci-workflows/.github/workflows/pr-review-cli.yml` in `components/runner-policy/policy.json`, matching the optional input added by melodic-software/ci-workflows#1154 (owner decision Q8). ## Fix - `components/runner-policy/policy.json`: appends `environment` to `allowedInputs` on both `intake-triage.yml` and `pr-review-cli.yml`. No secrets, caller permissions, runner routing, or `approvedShas` change. - Both reusables accept `environment` as an optional string defaulting to `""` and apply `environment: { name: ${{ inputs.environment }}, deployment: false }` to their Claude-secret jobs. Callers that omit `environment` see no change; callers that pass a branch-protected environment (such as `claude-lanes` restricted to `main`) tighten secret scope rather than loosening review. ## Verification - `node --test components/runner-policy/runner-policy.test.mjs`: 247/247 pass. - `node components/runner-policy/runner-policy.mjs --root .`: passed. - `check-jsonschema --schemafile components/runner-policy/policy.schema.json components/runner-policy/policy.json`: validation passed. - `biome check components/runner-policy/policy.json`: clean. ## Related - melodic-software/ci-workflows#1154 adds the optional `environment` input to both reusables. - Unblocks melodic-software/claude-code-plugins#17516 and melodic-software/claude-code-plugins#17537 after the standards sync distributes this update.
…story The estimator's regression read gzipped copies of pr-unblock.yml and its reusables at the last good commit and the #17516 commit. No review lane reads a gzip file, so both lanes held the pull request as binary-artifact. The check now reads those files with git show at the two commits named in the config: the good commit must stay under the fail line, the failing commit at or over it and within tolerance of failing-figure, so an estimator change that breaks either is a finding. The Lint Repo job that runs the check deepens to full history first; a missing commit exits 2. Co-Authored-By: Claude Opus 5.5 <[email protected]>
No related issue: owner decision Q8, hub session 2026-11-19 ("Okay, yeah, let's go with recommendations. As long as we can reduce friction without any security risk, and we put the protections and guards in place that will ensure that they never leak, then I'm okay with that.")
Summary
Who decided: the owner, verbatim, "As long as we can reduce friction without any security risk, and we put the protections and guards in place that will ensure that they never leak, then I'm okay with that." (Q8, 2026-11-19). Row: https://github.com/melodic-software/architecture/blob/89019b9963559c4ead6a4b151417d492e870d0d0/docs/owner-decisions.md#L244
Step 2 of the plan to let the lanes App edit
.github/workflows/safely. Every job in this repository that reads a Claude API key or Claude Code OAuth token now runs in theclaude-lanesenvironment, whose deployment branch policy admitsmainalone. A workflow file changed on any other branch can then never reach a Claude secret stored there. A new Lint Repo gate keeps it that way.Safe to merge before the environment holds any secret: an environment secret only shadows an organization secret of the same name, so until the owner loads them each job keeps reading the organization copies.
Fix
environment: { name: claude-lanes, deployment: false }.deployment: falsekeeps them out of the deployment history (GitHub: control deployments). A job that calls a reusable workflow cannot setenvironment, so the reusablepr-run-activity-read.ymlandmaintenance-measure-skill-edit-pass.ymlset it on their own jobs, and the callers keep passing each secret by name (GitHub: reuse workflows).workflow_run, notpull_requestorpull_request_target. GitHub blockspull_request_targetin public repositories from 2026-12-02 unless an Actions event policy allows it (changelog). Theeval: runlabel runs the newpr-record-eval-label.yml, which holds no secret and no token, and its completion runs the eval legs from main. That recorder run is the head's copy, so the legs read nothing it wrote:check-trusted-triggertakes its existingworkflow_runpath and resolves the open, same-repository PR whose head is the run'shead_sha;check-label-sender.shchecks the recorder path, the draft state, and alabeled/eval: runevent by the triggering listed human within ten minutes before the run, all from the API;workflow_run.head_sha, the label-time head.{ name: claude-lanes, deployment: false }on any job of a read run; the bare name still fails.scripts/check-claude-secrets-environment.shin Lint Repo, wired likeread-caller-keys(gated onrun_workflows, its own aggregate row). It fails:claudeoroauthin the name, any case;secrets[...];toJSON(secrets); a workflow-levelenv; or a name a local caller passes one under) withoutclaude-lanes;with: environment: claude-lanes(the literal name) orPENDING_REMOTEnames it;claude-lanes, or passing it aswith: environment, in a workflow apull_request,pull_request_review(_comment),merge_groupor off-mainpushstarts (aworkflow_callfile takes its callers' triggers)..github/lane-funding.jsonlists the three eval legs underworkflow_run, gatesame-repo.callers.test.mjsrecognizes that gate (an either-or whose every branch is a dispatch or holds the run's head repository, carried to later legs through a needed job's success or output, with paired cases) and treats aworkflow_run.head_shacheckout as untrusted.pr-merge-risk/workflow.test.mjsexpects the environment block after each leg'sif.docs/conventions/pr-pipeline/README.md, and a limit bullet under "Testing a lane change from its branch".Still pending. Three jobs wait in
PENDING_REMOTE. ci-workflows#1154 (merged) added theenvironmentinput to both reusables, and the gate accepts a literalwith: environment: claude-lanes, but:intake-triage.yml#intake-triagecannot pass it yet: runner-policy rejects the input because the vendored standards contract for ci-workflowsintake-triage.yml(.github/standards/runner-policy/policy.jsonallowedInputs) does not list it. That contract is owned by melodic-software/standards and arrives here by sync. Tried in 4813753 and reverted in f0ddc19 after Lint Repo failed: "the reusable workflow call has inputs absent from its reviewed contract: environment".pr-review-hosted.yml#pr-reviewandpr-review-security-hosted.yml#pr-review-securitystart onpull_request, which the environment refuses, and rule 3 fails them if they pass it. Moving them toworkflow_runmeans moving their head check and the ci-status and merge-gate readers (#17537).The organization copies must stay readable until all three land.
Renamed pass-through. Callers pass
PR_UNBLOCK_*andISSUE_LANE_*as the read workflow'sclaude-api-keyand similar names. That works in an environment job: "You can pass a secret by name even if it only exists in the environment" (GitHub). It is also proven in production.SCAN_CARRIER_PRIVATE_KEYexists only in thepr-pipeline-scan-carrierenvironment (no repository or organization copy), its callers pass it asscan-carrier-private-key, and the scan job's decode, which refuses an empty key (open.mjsparsePrivateKey), succeeded in run 44613075678. The live checks on the merged lanes are tracked in #17538: a branch run is refused at the environment, so they cannot run before merge.Verification
secrets.*CLAUDE*|*OAUTH*reads (diffempty). After the edits, with main merged:check-claude-secrets-environment: every job that reads a Claude secret names environment claude-lanes, and none runs from a head ref (253 job(s), 3 pending ci-workflows call(s)).runner-policy.mjs: "Runner policy passed."scripts/check-claude-secrets-environment.test.shgives PASS=34 FAIL=0. Each expected finding comes from the rule text. Five mutants of the checker were each killed by at least one case: dropoauth, ignore computed reads, drop caller-trigger inheritance, treat any push as main, ignore whole-context reads. Five cases coverwith: environmenton a remote call: literalclaude-laneson a dispatch passes; onpull_requestfails; another name or an expression fails; a pending caller that passes it fails as a stale entry.deployment: false, live: a scratch push-triggered job on a non-main branch with this environment never reached a runner. Run 44604030055: "Branch "probe/claude-lanes-env-policy" is not allowed to deploy to claude-lanes due to environment protection rules."check-label-sender.test.shruns 12 cases against a stubgh. Five mutants were each killed: drop the draft check, the time window, the recorder path, the actor match, or the human-only rule.check-read-caller-keys.test.shPASS=76 (3 new cases fail on the old checker);check-trusted-trigger.test.mjspass 485 (unchanged from main);plugin-eval/{workflow,credential-legs,eval-handoff}.test.mjspass;intake-triage/credential-legs.test.mjspass 2;check-affected-gates.test.shPASS=6;check-docs-only-gate.sh --checkclean;check-script-contract.test.shfails onlycheck-html-assets.sh, because htmlhint is not installed locally.npm ci, PyYAML) plus the three pins above, now updated:callers.test.mjspass 295,pr-merge-risk/workflow.test.mjspass 10,run-hygiene-gate.test.shPASS=10,check-docs-only-gate.test.shPASS=88.actionlintexits 0.zizmor --persona=regular --no-online-auditsreports no findings.workflow_dispatchsendsref: main/refs/heads/main(dispatch-record.mjs:30,feedback-dispatch.mjs:787,refine-event-dispatch.mjs:123,triage-sweep.mjs:547,reenter.mjs:326,handoff.bash:78,intake-triage.yml:2066), so none is refused.eval: runlabel, the same same-repository, non-draft and listed-human checks, and the label-time head. One difference: if the head moves between the label and the run, the run stops (check-trusted-triggerno-pr) instead of evaluating an outdated head, and labeling again runs the new head, as before.Related
environmentinput for the reusables (merged).workflow_run.🤖 Generated with Claude Code
https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj