Repository navigation
feat(runner-policy): accept a list of exact secret maps per contract - #970
Conversation
A reusable workflow contract's allowedSecrets may now be one exact map or a non-empty list of exact maps, the same shape allowedCallerPermissions took in #950. A caller passes while its secrets equal any one listed map exactly, so a secret change lands expand/contract instead of failing callers on either side of the sync. Every listed map is validated as the single map was (whole named-secret expressions, same-name or role-named mapping under a caller-permission waiver), and the visibility scan reads every listed map. Closes #968 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015XWwmb8QAX8QQkewRWMWYs
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
claude-security-review reviewed Security review: PR #970 (head 4ecc48e)No security findings. Scope. I read all 4 changed files in What the change does. A contract's Why it widens nothing.
Prose-level notes (not findings).
Settled/prior threads. None were supplied for this run. |
|
claude-review reviewed No findings. I read the full diff (README, schema,
|
Closes #971 ## Summary #950 (multi-map caller permissions) and #970 (multi-map secrets) let a contract list several exact maps so a change can land expand/contract. Nothing enforced the contract step. A listed map is fleet-wide, so no single repository's unused-entry check can tell that the old map has gone unused. This adds a required switchover date that the analyzer enforces. That was option 1 of the owner's decision (Q5, 2026-11-08). ## Fix - `policy.schema.json`: adds `allowedSecretsUntil` to both contract types and `allowedCallerPermissionsUntil` to runner-input contracts (`^[0-9]{4}-[0-9]{2}-[0-9]{2}$`). - `runner-policy.mjs` enforces the four rules for both fields: - At load, it fails a list of more than one map that has no date. - At load, it fails the date field on a single map or a one-entry list. - At audit, `contract-switchover-expired` fails once today (UTC) is past the date while more than one map is still listed. The finding names each contract and field, and says to remove the old map and its date field. - At audit, `contract-switchover-window` fails a date more than 90 days after today. - It also rejects a date that matches the pattern but does not exist, such as `2026-02-30`. - Each date rule emits one finding that names every affected contract, because findings are deduplicated by file, job and rule. - `auditRepository` takes an injectable `today` (`YYYY-MM-DD`) that defaults to the current UTC date. - `README.md`: item 3 of "Contract revision lockstep" now gives the date fields, their format, the 90-day cap, the failure the day after the date, and the rule that the follow-up removes the date together with the old map. The two lines that describe each field's shape point to it. - `policy.json`: no entry lists more than one map today, so none needed a date and the file is unchanged. ## Verification - `npm run test:runner-policy`: 247 pass, 0 fail. The baseline on `main` was 241. - The new tests cover each of the four rules for both fields. - They check the boundary days: a date equal to today passes and the next day fails; today plus 90 days passes and plus 91 fails. - They also cover two expired switchovers named in one finding, and invalid dates. - The test helper sets a fixed `today`, and the existing multi-map fixtures carry a date. - Mutation check: changing either boundary comparison from `>` to `>=` made the two boundary tests fail. Both comparisons are restored. - `node components/runner-policy/runner-policy.mjs --root .` reports "Runner policy passed." against the real `policy.json`. - The pre-commit hooks passed: biome, markdownlint, editorconfig, typos and gitleaks. ## Related - Refs #950 (multi-map caller permissions) - Refs #970 (multi-map secrets) - Refs melodic-software/ci-workflows#1040 (the planned surface check; it reads the synced contract and must accept the two new date fields) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015XWwmb8QAX8QQkewRWMWYs Co-authored-by: Claude Opus 5.5 <[email protected]>
Closes #968
Summary
A secret change to a reusable workflow's runner-policy contract had a built-in deadlock window: every caller had to send exactly the contract's one secret map, so callers on either side of the component sync failed
ci-statusuntil both sides landed. This givesallowedSecretsthe same expand/contract shape #950 gaveallowedCallerPermissions.Fix
policy.schema.json: a newsecretMapsdefinition,oneOfone exactstringMapor a non-empty, unique list of them. BothrunnerInputContractandhostedOnlyContractreference it forallowedSecrets.runner-policy.mjs: feat(runner-policy): accept a list of exact caller permission maps for a migration #950's helpers become shape-neutral (exactMapEntries,exactMapsError) and now serve both permissions and secrets. A caller'ssecrets:block passes when it equals any one listed map exactly. There is no subset or superset matching. With a single map, the error wording is the same as before. With a list, a mismatch names every listed map. Every listed map is validated the way the single map was: each value must be one whole${{ secrets.<NAME> }}expression, and a contract with a caller-permission waiver must map same-name or role-named. The visibility-scoped contract scan reads the union of all listed maps, so a denylisted secret that appears only in the new map is still caught.README.md: "Contract revision lockstep" item 3 now describes the expand/contract order for secrets and permissions together. The lines that describe the secret map's shape now cover the list form.policy.jsonentry changes.Verification
npm run test:runner-policy: 241 pass, 0 fail. The baseline onmainwas 232. The nine new tests cover:Related
allowedCallerPermissions)allowedSecretsand must accept the list form)🤖 Generated with Claude Code
https://claude.ai/code/session_015XWwmb8QAX8QQkewRWMWYs