Skip to content

feat(issue-sync): record a published security entry in the site repository through a pull request - #2229

Merged
potiuk merged 2 commits into
apache:mainfrom
potiuk:feat/advisory-records-pr-mode
Nov 22, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
potiuk:feat/advisory-records-pr-mode

Conversation

@potiuk

@potiuk potiuk commented Nov 22, 2026

Copy link
Copy Markdown
Member

Why

Some projects' site repositories take changes only through reviewed pull requests, and some plan to build their security section from one JSON file per published entry.
The security-records step of issue-sync commits straight onto the configured site branch and pushes it, so those projects cannot use it.

What

An opt-in publish: pull-request mode for the site-records block in project.md (the default stays direct, so nothing changes for existing adopters):

  • The person running sync commits the record on a new branch (pull_request.branch, by default named after the entry), pushes it to their own fork of the site repository, and opens a pull request against the base branch. Nothing is pushed to the site repository itself.
  • The planner prints eleven confirmed commands, in order: clean, branch, update, new-branch, the --apply run (also writes the pull-request body file), stage, diff --cached, commit, push <fork remote> <branch>, switch <base>, gh pr create. The existing publication gate still runs first; the body carries no tracker text.
  • The closed-tracker state step follows the pull request: before the first status comment it looks one up by branch (gh pr list --head), so an open or merged one is recorded, never opened twice; the status comment records the pull request URL; once it merges, sync proposes a second marker comment with the ticked security-pages item; a closed one is a blocker.
  • Per-user settings: user.md gets environment.advisory_records_fork and _fork_remote, next to the existing working-copy override.
  • issue-sync now opens a pull request, so it carries the shared pre-PR adversarial review block, run between the commit and the push.

Guards checked

  • agent-guard's security-language guard refuses an entry ID in any gh pr create title or body; the planner adds its documented inline exemption MAGPIE_ALLOW_SECURITY_LANG=1 (for a disclosure that is already public) and prints the command only past its publication gate. Verified with the dispatcher: denied without it, allowed with it.
  • The public-surface-scrub mod passes gh pr create --repo <site repo> when the site repository is named differently from upstream_repo; it refuses when the site lives in the source repository or upstream_repo is unset (its only exemption is a session-level variable), so the design doc says such projects keep the direct mode.
  • magpie-vcs scrubs only with --scrub, which the planner does not pass, so the commit message and branch name are not refused.
  • vetted-op-git is not used: its policy pins the source repository and one fork, and its git-pr-create has no post-disclosure exemption. The design doc under docs/security/ explains this.

Tests

  • uv run --group dev pytest in the planner and security-management packages (new cases for the command order, body file, settings errors, the Git-only rule, the gate, and every state of the pull-request lookup).
  • prek run --skip workspace-pytest --files <changed files> and prek run workspace-pytest --files <changed files>: all passed.
  • New eval fixtures: security-issue-sync 2b case 13 and pointer-routing case 11 (not run against a model yet).

🤖 Generated with Claude Code

@github-actions github-actions Bot added family:security security-* skills family:setup setup-* skills family:tools tools/* family:docs Docs, MISSION.md, READMEs capability:intake Import external signal + sync tracker state capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) contract:tracker Tool capability: issue / board / label backend contract:source-control Tool capability: branch / commit / diff / push (VCS) contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) contract:cve-authority Tool capability: CVE allocation / record management / publication substrate:analytics Tool substrate: read-only metrics / dashboards / renderers substrate:framework-dev Tool substrate: build / validate / eval the framework itself contract:people family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json labels Nov 22, 2026
@potiuk
potiuk enabled auto-merge (squash) November 22, 2026 09:40
…itory through a pull request

Some site repositories take changes only through reviewed pull requests,
so the security-records step that commits straight onto the site's
branch cannot be used there. A new opt-in publish mode makes the sync
operator commit the record on a new branch, push it to their own fork of
the site repository and open a pull request against the base branch;
nothing is pushed to the site repository itself. The direct mode stays
the default.

- The planner takes --publish pull-request with --fork, --fork-remote,
  --pr-repo (derived from a GitHub repository URL), --pr-branch and
  --pr-title. It prints eleven confirmed commands: clean, branch,
  update, new-branch, the --apply run (which also writes the pull-request
  body file), stage, diff, commit, push to the fork, switch back to the
  base branch, and gh pr create. The publication gate still runs first,
  and the body carries no tracker text.
- The closed-tracker state step follows the pull request: before the
  first status comment it looks one up by branch, so an open or merged
  one is recorded instead of opened twice; the status comment carries
  the pull request URL; a merged one gets a second marker comment with
  the ticked security-pages item; a closed one is a blocker.
- gh pr create carries MAGPIE_ALLOW_SECURITY_LANG=1, agent-guard's
  documented exemption for a disclosure that is already public; the
  public-surface-scrub hook passes a site repository named differently
  from the source repository, and a site living in the source
  repository keeps the direct mode. The design doc explains why the
  mode uses magpie-vcs and gh rather than vetted-op-git.
- Per-user fork settings live in user.md
  (environment.advisory_records_fork, _fork_remote), next to the
  working-copy override. The sync skill gains the shared pre-PR
  adversarial review block, run between the commit and the push.
- Two eval cases cover the pull-request proposal and the routing for a
  merged pull request.

Generated-by: Claude Opus 5
CodeQL flagged an assert whose expression wrote the record file, so the
write would vanish under `python -O`. Write it first, then assert.

Generated-by: Claude Opus 5
@potiuk
potiuk force-pushed the feat/advisory-records-pr-mode branch from da176be to e29c3ae Compare November 22, 2026 09:53
@potiuk
potiuk merged commit 184e152 into apache:main Nov 22, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:intake Import external signal + sync tracker state capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) contract:cve-authority Tool capability: CVE allocation / record management / publication contract:people contract:source-control Tool capability: branch / commit / diff / push (VCS) contract:tracker Tool capability: issue / board / label backend family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json family:docs Docs, MISSION.md, READMEs family:security security-* skills family:setup setup-* skills family:tools tools/* substrate:analytics Tool substrate: read-only metrics / dashboards / renderers substrate:framework-dev Tool substrate: build / validate / eval the framework itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants