Skip to content

Commit 6d1dc7f

Browse files
feat(pm): the fleet-write relay publishes an approved security advisory — reopen, set the versions, publish (#30135)
Fixes #30110 ## 维护者速读 - 改了什么:中继(fleet-write)现在能发布安全公告——`advisory_state` 新增「已关闭→草稿」与「草稿→已发布」两种迁移,新增只写版本范围的 `advisory_versions` 一行,发布后回读校验并在运行注释里点名公告编号。 - 为什么改:维护者裁定中继必须能发布(原「发布留给我」一条作废);发布哪些仍由维护者在发版前定清单,中继只执行批准的清单。 - 风险与回滚:发布不可逆、发布即公开;中继在发布前强制要求版本已设、只允许从草稿发布、执行端自读公告再判,任何未知状态一律拒;回滚即还原本 PR(4 个中继脚本 + 3 份技能参考)。 - 先看:`scripts/pm/fleet-write/ops.mjs` 的 `ADVISORY_TRANSITIONS` 与 `ADVISORY_FENCES` 新增的 `versions` 围栏;`execute.mjs` 的 `advisoryPreflight` / `confirmAdvisory`;`security-findings.md` 删去的一行(见 Acceptance notes)。 - 两分钟验证:`node scripts/pm/fleet-write/validate.mjs --self-test && node scripts/pm/fleet-write/execute.mjs --self-test`,预期分别打印 329 与 269 个用例全过。 - 需要你做的:合入后从你批准的发布清单里点一份公告,让席位经中继做首次实发并把运行编号记在本卡。 ## What changes The relay could not publish a security advisory: `published` was refused by name and `ADVISORY_TRANSITIONS` allowed only `triage → draft` and `triage|draft → closed`. The maintainer ruled that the relay must publish (the ruling and the superseded clause are quoted verbatim in the `ops.mjs` header). What is published stays the maintainer's list, approved before each release. - **`advisory_state` gains two transitions.** `closed → draft` (the reopen; a fixed advisory is closed once its fix merges) and `draft → published`. Nothing leaves `published` or `withdrawn`. Each move is still judged on the executor's own GET. A target the table does not name now has no from-states and fails closed at the state fence (before this PR, an unknown target would have fallen back to the collaborators' open states; the validator's enum already kept it out, and now both layers refuse it). - **`ADVISORY_REFUSED_STATES` loses `published`** and is empty; the field's named-refusal hook stays wired. - **A new row, `advisory_versions`.** It carries `ghsa_id` and `versions`, a capped list of closed entries: exactly `package` (an npm name), `vulnerable_version_range` and `patched_versions`. No prose, no summary or description, no vulnerable functions, no state. The range takes one comparator, or a lower bound then an upper bound, each an operator, one space and a release version (GitHub's own example spelling). The patched list holds one to five release versions. A pair whose bounds do not rise, a version named twice, and a patched version inside its own range are refused. The PATCH body is `{ vulnerabilities }` alone. It travels alone like every advisory row, and its token carries `repository-advisories: write` for that stroke only. - **The versions fence.** GitHub's documentation of this PATCH says "To add vulnerable versions, include existing versions in the array", so the call replaces the whole list. The executor therefore sends versions only to a `draft` whose every listed package the action names. A listed entry of another ecosystem, a nameless one, or one carrying `vulnerable_functions` (which the row does not write and the PATCH would drop) is refused with nothing sent. A publish is refused unless the advisory's GET lists at least one entry and every entry is in the row's spelling: the versions are set first. - **The publish read-back.** A publish lands only when the PATCH answer reads `published` AND lists exactly the entries the preflight GET read (order ignored), so the advisory is read back as published with the versions it was sent. A landed publish alone emits a notice annotation naming the id (public once published). The seat-side reader (`dispatch.mjs`) parses it, hands it on as `advisories`, and says to record the run on the seat post. Every other state move stays unannotated. - **What crosses the public run.** The versions row and the publish print the id, the state and counts. They never print a package name or a version, which belong to the unpublished advisory until the publish. Refusals never echo a value. - **Skill references** (`.claude/skills/pm-dispatch/references/`). `security-findings.md` §3 now says that the seat publishes only the list the maintainer approved for that release, through the relay, versions first, recording the run ids on the seat post with no text. §9 says that the publish list stays the maintainer's. `lanes/security.md` points to §3 instead of "publish by hand in the UI", per §8's one-place rule. `rest-channel.md` no longer says that publishing is the maintainer's by hand. Every file stays at its ratchet ceiling. **Governed surface:** the diff touches `.claude/**` (Tier S). It lands on the owning seat's contract-tier review of record, not on green alone. ## Tests Relay self-tests, at the base `1f13eb3189` and then at this head: | self-test | base | head | advisory battery floor | |:--|--:|--:|:--| | `validate.mjs` | 303 | 329 | 51 → 77 | | `execute.mjs` | 260 | 269 | 32 → 41 | | `dispatch.mjs` | 315 | 318 | 14 → 17 | The pins that said "⛔ published is reachable by NO row" moved with the ruling. They now say that published is reached by ONE row (`advisory_state`), through ONE field value, from `draft` alone, through the versions fence, and that no request any row spells carries it in a path or a body. The unknown-state cases still fail closed, at the validator's enum and at the state fence. The executor's marker sweep now covers 73 runs, up from 46, including every publish and versions run. The marker reaches no log line, row, summary, annotation or pace log. **Ablation, one-shot.** Each mutation went through `scripts/ablation-replace.mjs` (anchor hit 1 → 0, blob changed) and was restored there (blob == HEAD, `git diff HEAD` empty): - A: `published` may also leave `closed`. `validate` went red on 2 cases (the transition table and the fenced transitions). `execute` went red on 1 case: an illegal `closed → published` sent a PATCH. - B: the fail-closed default removed (an unknown target falls back to the open states). `validate` went red on 1 case (the unknown target fails closed). `execute` stayed green: its preflight independently gives an unknown target no from-states, so the second layer held. - C: the publish half of the versions fence removed. `validate` went red on 3 cases. `execute` went red on 1 case: an unversioned publish sent a PATCH. ## Acceptance notes - **Measured from documentation, not live.** No advisory was touched during development. The REST description (operation `security-advisories/update-repository-advisory`) and the App permission ledger put `state` (published, closed, draft) and `vulnerabilities` (package, range, patched versions, functions) on one PATCH, under `repository_advisories: write` alone, with no additional permission. The App's PATCH of `state` is already measured live (`triage → draft` and `draft → closed`, runs 41443030055 and 41443112178). The first live publish after merge confirms four things: `closed → draft`, `draft → published` and the versions from the App, the versions answered in the spelling sent (the read-back compares the strings exactly, so a platform that normalises them fails closed with nothing re-sent), and whether the platform needs versions before publishing (the relay needs them either way). - **One line deleted to pay the line ratchet.** `security-findings.md` had zero headroom. Its §2 line "while the relay run log still prints the whole payload, no mechanism in the relay payload" is conditional on a state that no longer holds: the relay reads `client_payload` from the event file and prints none of it (pinned by `validate.mjs`'s event-file battery and the live marker runs). It also contradicts §3, which routes the mechanism through `advisory_create`'s payload. If the seat prefers to keep it, the alternative is a ruled +1 on that file's ceiling. - **Not edited:** `.github/workflows/fleet-write.yml`'s comment still lists "FOUR write consumers" of `permission-repository-advisories` and does not name `advisory_versions`. The mint input itself needs no change. The comment lives on a Tier H surface, so it was left out of this Tier S PR. - `ops.mjs`'s `requests` documentation named a `confirmAdvisoryCollaborators` that never existed. The sentence was rewritten to name `confirmAdvisory`. ## Verification Head `5aa0bddcdc` (the branch merged with `origin/main`): `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 46 families, and all 46 ran locally, each with its exit captured before any pipe. `--ran` reconciliation: "46 derived famil(ies) accounted for — 46 run, 0 NOT-MEASURED (a DERIVED zero …)". <details><summary>Local gate exits</summary> Every family exited 0. `pnpm --filter @objectstack/lint run check:doc-formula-expressions` first exited 3 (PREREQUISITE NOT MET: `@objectstack/formula` and `@objectstack/lint` unbuilt). It exited 0 after `pnpm exec turbo run build --filter=@objectstack/formula --filter=@objectstack/lint` under the shared verify lock ("VERDICT command-exit 0"). The relay importers outside the derivation, `fleet-roster`, `mailbox-open` and `rerun-failed`, were also run with `--self-test`, and each exited 0. </details> Families CI runs beyond the local subset are read from this PR's check-runs. ## Seat note - The card's `Claim:` naming this branch was owed by the dispatching seat at dispatch (step 2) and has now been posted on #30110. This body edit re-runs `PR-body guards`, which read its absence on the first run. <!-- signed: security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b83e1d0 commit 6d1dc7f

7 files changed

Lines changed: 714 additions & 190 deletions

File tree

‎.claude/skills/pm-dispatch/references/lanes/security.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
- 复核者只拿分析与证据,⛔ 不拿本席结论;核四轴、选项无漏、推荐成立、证据为真。
3434
- 问题随附复核判词与全部异议。
3535
- 每次发版前呈发布与否清单:上次发版后 `closed` 的公告,高危、中危在前;先经上条复核。
36-
- 发布归维护者:在公告界面重开并发布,中继推不动已关公告。
36+
- 维护者批准清单后,本席经中继发布,照 `../security-findings.md` 第 3 节;⛔ 不发清单外的。
3737

3838
## 收口(逐对象)
3939

‎.claude/skills/pm-dispatch/references/rest-channel.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
- ✓ 请审 `POST .../pulls/{n}/requested_reviewers`(Tier H 归中继 op)· 开 PR `POST .../pulls` 带 `draft=true`。
4848
- ✓ `origin/main` 合进 PR head:中继 op `pr_update_branch`(`pull` + 40 位 `expected_head_sha`),真合并提交。
4949
- 挂子卡走中继 op `sub_issue_add`/`sub_issue_remove`(`issue` 父号,`sub_issue` 子号),回读父列表。
50-
- 公告经中继 `advisory_create`(首选)等四操作,规则住 `security-findings.md`;发布归维护者。
50+
- 公告经中继 `advisory_create`(首选)等操作,发布亦经中继;规则住 `security-findings.md`。
5151
- 读公告经中继 `advisory_read`:席位进程一次性密钥,密文回传;`--reveal` 才印明文到 stdout。
5252
- ✓ 落地经中继 `node scripts/pm/fleet-write/dispatch.mjs --repo O/N --actions-file F`;`--via dispatch` 同载。
5353
- ✓ 启动 run 走 op `workflow_dispatch`:解锁物是白名单 run 才启;入表只经 workflow 自己的 PR。

‎.claude/skills/pm-dispatch/references/security-findings.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
- ⛔ 不立 issue,锚卡、跟踪卡与收口卡也 ⛔ 不提。
1414
- ⛔ 机制不进 PR 标题、正文与评论,提交信息,changeset,复核记录,信箱。
15-
- 中继运行日志仍打印整份载荷时,⛔ 机制不进 fleet-write 中继载荷:该日志公开。
1615
- 测试名写规则,⛔ 不写攻击。
1716

1817
## 3. 私卡是仓库安全公告(选 B)
@@ -21,7 +20,8 @@
2120
- 首选中继 `advisory_create` 建草稿公告,再 `advisory_collaborators_add` 带具名账号进公告。
2221
- 读公告只走中继 `advisory_read`(席位账号读被拒):一次性密钥只在席位进程,只回密文。
2322
- `advisory_report` 与 `advisory_create` 同铸公告写权,无此权的仓两者皆拒;私报另有账号日限。
24-
- ⛔ 席位永不以自身账号私报或写公告:GitHub 写只走中继,以 App 身份;发布归维护者。
23+
- ⛔ 席位永不以自身账号私报或写公告:GitHub 写只走中继,以 App 身份。
24+
- 只发维护者为该版批准的清单:经中继先定版本再发布;运行编号记座位贴,⛔ 无正文。
2525
- 两操作皆被拒 ⇒ 会话专递(选 A):机制只在会话里交维护者,由其建草稿,⛔ 不换账号重发。
2626
- 私有仓无私密漏洞报告功能,那些操作上线后仍会话专递。
2727
- 回退时座位贴只写不透明编号与状态,⛔ 无细节。
@@ -60,5 +60,5 @@
6060
- 每份安全发现从接收到发布归 `security#1` 席(章程 `lanes/security.md`),发现者只报不修。
6161
- ⛔ 不扩本 PR 或分支,不自开修复分支,不在同一面顺手加固;dev 只走第 5 节上报。
6262
- 席位与 QA runner 两件事:中继 `advisory_create` 建草稿;敲 `Notify: security · GHSA-ID`,只带编号。
63-
- 中继拒(第 3 节)⇒ 机制在会话里交 `security#1` 席;席空缺 ⇒ 交维护者;发布恒归维护者。
63+
- 中继拒(第 3 节)⇒ 机制在会话里交 `security#1` 席;席空缺 ⇒ 交维护者;发布清单归维护者。
6464
- 任务绕不开它 ⇒ 报 `blocked`,只写「a security item is with the owner seat」;席位停卡,⛔ 不绕行。

0 commit comments

Comments
 (0)