[Infra] Default bootstrap to active enforcement and fail closed on ruleset downgrades - #65
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8fae9f367
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR performance and binary-size diff
Baseline unavailable for exact PR base Performance
Binary size
Size deltas are deterministic for identical build inputs. Performance deltas compare separate hosted runners and should be treated as directional evidence, not a pass/fail threshold. |
…leset downgrades Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review: comparing bypass_actors by length let a re-run swap one actor for another without ALLOW_PROTECTION_DOWNGRADE, and the enforcement guard missed evaluate -> disabled. Compare requested actors as a subset of currently granted ones and order enforcement levels instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8859468 to
20ea398
Compare
## Summary - Every `uses:` reference across the five workflows (`ci`, `codeql`, `release`, `release-dry-run`, `pr-metrics-comment`) is now pinned to a full commit SHA with the release version recorded in a trailing comment. A movable major tag lets a tag replacement change the code that CI and release jobs execute without a reviewed diff; the SHA makes the executed bytes part of the reviewed history. - `audit-ci-policy.sh` (run as `audit:ci` in the repository health check) now rejects any workflow action reference that is not a 40-hex commit SHA, so a future workflow edit cannot quietly reintroduce a movable ref. Local `uses: ./…` references stay exempt. - Every SHA↔version pair was verified against the GitHub API (`repos/<action>/commits/<tag>`) before landing; the pins match the ones tex-core reviewed. - Ported from tex-core (nouprax/tex-core#70), the same direction as #36/#37/#39/#65. - No CHANGELOG entry: markdown-core's changelog records release changes only, matching the previous mirrors. ## Verification `audit:ci` green on the pinned tree; negative test confirmed the new check fails with a pointed message when a single ref is reverted to `@v7`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
## Summary - The repo-managed Python tool venvs now install from hash-locked requirements files (`pip --require-hashes`): `scripts/requirements/clang-format.txt` for the clang-format venv in `init-environment.sh`, and `scripts/requirements/cmakelang.txt` (cmakelang + PyYAML + the transitive six) for the cmake-format venv in `format-cmake.sh`, which is where markdown-core builds that venv. Every distribution PyPI publishes for the pinned versions is enumerated, so an index-side replacement cannot change the bytes the tools run. - `install_emscripten` now pins the emsdk manager itself to `EMSCRIPTEN_COMMIT` — the immutable commit of the `4.0.23` release tag, kept in lockstep with `EMSCRIPTEN_VERSION` — and verifies the checkout, so a moved tag or new default-branch commit can never change the installer bytes it executes. - `audit-ci-policy.sh` (`audit:ci`) now enforces all of this: it fails if `init-environment.sh` loses the emsdk commit pin or `--require-hashes`, or if `format-cmake.sh` loses `--require-hashes`. - Ported from tex-core (nouprax/tex-core#70), the same direction as #36/#37/#39/#65/#66. Adapted where the repos differ: markdown-core installs cmakelang via `format-cmake.sh` rather than inline in `init-environment.sh`, so the requirements file is wired (and audited) there. The emsdk commit was verified against the GitHub API to be the `4.0.23` tag commit. - No CHANGELOG entry: markdown-core's changelog records release changes only, matching the previous mirrors. ## Verification `audit:ci` green with the new checks active; both requirements files installed for real with `--require-hashes` into fresh venvs on macOS arm64 (`cmake-format 0.6.13`, `clang-format 22.1.8`); the modified `format-cmake.sh --check` ran end-to-end against the repo with a fresh tool dir; `shellcheck` reports nothing new on either script. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
bootstrap-repository.shnow defaults to the mature-repository shape:RULESET_ENFORCEMENT=activeandMAIN_ADMIN_BYPASS=false, so a maintenance re-run with only the required inputs converges on full protection instead of silently re-weakening it. Initial bootstrap of a fresh repository can still opt intoRULESET_ENFORCEMENT=evaluateexplicitly while CI stabilizes, exactly as the migration runbook already does.upsert_rulesetnow fails closed when updating an existing ruleset: downgrading enforcement fromactivetoevaluate/disabled, or adding bypass actors beyond the current set, aborts with an explanation unlessALLOW_PROTECTION_DOWNGRADE=trueis passed deliberately.docs/repository-setup-template.md, so this PR touches that one spot (same as [Infra] Pin squash-only merges with PR-title messages in bootstrap #39).Verification
shellcheckclean andbash -non the extracted embedded script;audit:repositoryandaudit:cigreen.🤖 Generated with Claude Code