Repository navigation
Commit b617675
feat(fleet-write): the relay replaces an unpublished advisory's summary and description, sealed like a note (#36672)
Fixes #36662
Clause-②: no
Metadata-protocol: none
Rule-change: yes
## 维护者速读
- 用户无感:安全席发布公告前,现在可以经中继把未发布公告的标题摘要和正文整段换成对外文本,不用再到网页逐份手改。
- 属于安全公告发布流程,替安全席解决「中继改不了正文」这件事。
- 出错时这一步失败并停下,已发布或已撤回的公告一律不碰;新正文在载荷与日志里都不出现,改错可再换一次。
- 发布也多了一道把关(改了已有的
`advisory_state`):正文里只要还有一行席位签名(也就是内部备注),或者正文不是文本,发布就被拒绝。被拒时只读一次、不写任何东西,只报出备注的行数,不带任何正文。这道关只能证明正文里没有席位备注,不能证明正文已经替换过;它的检查时点是发布前那唯一一次读取。
- 要你做:审阅并批准落地(本 PR 改了车队规则文件,需你本人批准)。
## What changes
A new relay row, `advisory_rewrite`, replaces the `summary`, the
`description`, or both, of a repository security advisory that is not
published. It rides the `advisory_note` machinery end to end; no second
sealing path exists.
- **Seat (`dispatch.mjs`).** The actions file names `summary_file`
and/or `description_file`. Each path goes through
`advisoryNoteFilePlace` (outside every git repository, at its real path)
before it is read. `advisoryRewriteCompose` trims, adds no signature
line or stamp (this is the public text) and spells the fields as one
JSON object. `armAdvisoryNotes` then seals it with the note's
`sealAdvisoryNote`, the committed relay key and a fresh one-time digest
key. The payload carries `ghsa_id` and `sealed_note` alone.
- **Associated data (`ops.mjs`).** `advisorySealAad` gains the rewrite's
own prefix and op, so a note's seal never opens as a rewrite and a
rewrite's never as a note.
- **Executor (`execute.mjs`, `advisoryRewriteAction`).** It follows the
note's order: the key, then a fenced GET (`ADVISORY_REWRITE_FENCES` =
the note's fences with states `triage`/`draft`/`closed`, plus a summary
that is text). Then the open, the text judged again
(`advisoryRewriteFailure`), the mask, and a second fenced GET (a summary
or description changed since the first is refused). Then ONE PATCH of
exactly the fields sealed, and the read-back
(`advisoryRewriteReadBack`): the PATCH answer, then a GET after it,
holding each field sent byte for byte and the field not sent as read. A
mismatch is a FAILED action carrying `ADVISORY_REWRITE_NOT_RESENT`.
- **Read-back digest.** The run's ONE notice is the note's spelling with
op `advisory_rewrite`. Its keyed digest is taken over the text the
advisory STORES after the PATCH (`advisoryRewriteStoredDigest`), not
over the text opened. `confirmRunAdvisoryNotes` holds it to the digest
the seat sealed, so a seat-side match reads back the stored bytes.
- **Validator (`validate.mjs`).** The stroke mark is now derived
(`SEALED_TO_RELAY_OPS`, the rows requiring `sealed_note`), so a rewrite
stroke writes `advisory_note=yes`. The workflow's existing line
therefore hands it the relay key with no workflow change. The row is
`alone: true` and spends `repository-advisories: write`, the note's
grant and gate.
- **Nothing printed.** Refusals name keys, states, fields and byte
counts; the landed row prints the id, the state, per-field byte counts
and the keyed digest.
- **Docs.** The fleet-write headers (`ops.mjs`, a new section "The one
row that REPLACES an advisory's text"; `execute.mjs`; `dispatch.mjs`,
with its usage text). The security lane's publish step (呈维护者) now names
the order `advisory_rewrite` → `advisory_versions` → `advisory_state`.
`security-findings.md` §3 names the row and the order.
**Which states the platform takes the PATCH in (still a reading; the
first live rewrite is owed by the security seat after merge) — source:
GitHub's REST description, not a live advisory.** Operation
`security-advisories/update-repository-advisory` in
`github/rest-api-description`
(`descriptions/api.github.com/api.github.com.json`, read 2026-11-23)
states no state restriction for `summary` (maxLength 1024) or
`description` (maxLength 65535). Its one documented refusal is a state
move, `published` → `draft` (422, "Invalid state transition"). Nothing
was measured against a real advisory: per the order, no advisory of this
repository was read, created or PATCHed from this session. The fence is
the relay's and narrower than the platform's: `triage`, `draft`,
`closed` (the note's states). The first live rewrite on a draft the
security seat chooses after merge confirms it; `triage` and `closed`
stay documentation readings until a rewrite lands in each. This is
stated in the row's doc.
**Publish fence (changes an existing row, `advisory_state` →
`published`).** A publish is REFUSED while the description carries a
seat signature line, matched per line after trimming and CRLF-tolerant
against a lane-agnostic superset of `SEAT_SIGNATURE_LINE`. It is also
refused when the description is neither text nor null. The fence is
judged on the row's own GET just before the PATCH. A refusal is one GET
and zero writes, a fixed sentence and a count, and no text. The fence
proves the description holds no seat note; it does not prove a rewrite
happened. Its window is that one read (stated in both headers). The
lane's publish step states it as 「正文含席位签名行即拒」.
**Governed surfaces.** The diff touches
`.claude/skills/pm-dispatch/references/lanes/security.md` and
`.claude/skills/pm-dispatch/references/security-findings.md`
(`.claude/**`). `Rule-change: yes`. Two rule lines in the lane's publish
step change: the order (`advisory_rewrite` → `advisory_versions` →
`advisory_state`) and 「正文含席位签名行即拒」. Because the publish order the
security seat follows gains a step, so this PR is Tier H and lands only
on the maintainer's approval. `scripts/pm/fleet-write/**` is not a
governed path. The workflow file is untouched.
**Byte ratchet.** Both doc files were at their ceilings with zero
headroom, and no ruling comment orders text into them. The new rule is
paid for by deletion inside each file (`check-skill-line-ratchet` green:
3933/3934 and 4193/4194). Every deletion is a reason, an example or a
restatement whose rule stands elsewhere:
- dropped 「一步即成」;
- dropped 「(席位账号读被拒)」;
- dropped 「(cloud 即 cloud 车道)」;
- dropped the lane doc's restated 「文件置 git 仓外」 (§3 keeps it);
- dropped the state list after `advisory_list`, which lists exactly
those states by construction;
- dropped 「本文是本车道岗位说明,」, a description of the file;
- small rewordings (「只有」→「仅」, 「自己的」→「其」).
## Tests
All local, on head `f1418cd9`:
| Self-test | Before (BASE `9348f02b`) | After |
|:--|:--|:--|
| `node scripts/pm/fleet-write/validate.mjs --self-test` | 436 cases /
22 batteries | **453 / 23** |
| `node scripts/pm/fleet-write/execute.mjs --self-test` | 443 / 30 |
**460 / 31** |
| `node scripts/pm/fleet-write/dispatch.mjs --self-test` | 418 / 33 |
**430 / 34** |
Each file's battery floor is raised by one. The new batteries cover what
the card lists, plus the publish fence (each edited seat-note head,
CRLF, padding, a signature at the top and the bottom, a non-text
description, and public text with a stamp-shaped line that is not
counted):
- a refusal for a published advisory (validator fence; executor: ONE
GET, zero writes);
- a refusal for an empty description (validator judge, executor re-judge
after the open, seat compose);
- a refusal when a text file sits inside a repository (this checkout,
another clone, one of two files inside);
- the round-trip digest check (validator unit; executor notice parsed by
the seat's parser; seat end to end against the real executor, plus a
foreign seal's digest UNVERIFIED, exit 6);
- a payload carrying no plaintext (validator and seat, as text and in
the decoded seal);
- a marker sweep over every executor run: no byte of the new or old text
on any log, row, summary, annotation or pace line.
Existing pins that enumerate the advisory rows were extended: the alone
list, the repository-advisories spenders, the security-advisories
request list, the rows table, and the per-op fixture tables.
<details><summary>Mutation proof — each new assertion can fail (5 legs,
via scripts/ablation-replace.mjs, each restored with git checkout HEAD
and git diff HEAD empty)</summary>
| Mutation | Case that went red | Self-test |
|:--|:--|:--|
| `advisoryRewriteReadBack` skips the field compare | "the read-back:
exactly the fields sent land…" | validate 1 of 450 |
| same | "the read-back: a PATCH answer whose description is not the one
sent is NOT STORED…" | execute 1 of 458 |
| `ADVISORY_REWRITE_STATES` admits `published` | "a PUBLISHED advisory,
a withdrawn one…" | execute 1 of 458 |
| the PATCH body gains a `state` key | "REPLACE: the PATCH carries {
summary, description } and nothing else…" and "a description alone…" |
execute 2 of 458 |
| the seat skips the placement check for a rewrite | "a text file inside
a git repository is REFUSED before it is read…" | dispatch 1 of 430 |
</details>
## Acceptance notes
- `.github/workflows/fleet-write.yml` comments (header and the execute
step's env comment) still say the note key reaches the execute step
"only for an `advisory_note`" stroke. The behaviour is unchanged and
correct: the line keys on the validator's `advisory_note=yes`, which a
rewrite stroke now also writes. The comment is stale, but the workflow
is outside this card's file surface and is a Tier H path, so it is left
alone. carrier: #36684.
- `ops.mjs`' grant paragraph said "the seven rows spending"
repository-advisories before this change, which was already one short
(`advisory_note`). It now names all nine.
## Verification
Read first, by risk:
1. `scripts/pm/fleet-write/execute.mjs` — `advisoryRewriteAction`: the
fence states, the second read, the PATCH body, the read-back and the
stored-text digest.
2. `scripts/pm/fleet-write/dispatch.mjs` — `armAdvisoryNotes`, the
rewrite branch: the placement check before any read, and the file keys
removed from the action.
3. `scripts/pm/fleet-write/ops.mjs` — `advisorySealAad` (the rewrite's
own associated data) and `advisoryRewriteFailure`.
Two-minute check: `node scripts/pm/fleet-write/execute.mjs --self-test`
prints `460 cases pass across 31 batteries`, among them the
`advisory_rewrite` battery.
<details><summary>Local gates — the derived list (node
scripts/pm/dispatch-gates.mjs --commands, 70 families) on head
f1418cd</summary>
- `node scripts/pm/dispatch-gates.mjs --ran` with exit codes recorded:
**70 derived, 68 run, 2 NOT-MEASURED, 0 UNRUN**, exit 0.
- 68 exited 0, among them `pnpm check:pm-fleet-write-validate`,
`-execute`, `-dispatch`, `pnpm check:pm-skill-ratchet`, `pnpm
check:nul-bytes`, `pnpm check:pm-governed-prose`, `pnpm
check:pm-skill-id-lint`, `pnpm check:doc-authoring` and `pnpm
check:pm-dispatch-gates` (2264 cases, fast tier).
- NOT MEASURED, exit 3 (`PREREQUISITE NOT MET`): `pnpm --filter
@objectstack/lint run check:doc-formula-expressions` (needs
`@objectstack/formula` built) and `pnpm check:i18n-coverage` (needs the
CLI built). This diff touches no package; both families belong to CI.
- Repo-wide scans (`pnpm lint`, the full farm) are CI's.
</details>
Contract review: PASS at `f1418cd9` (security seat, comment 7101303609).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov
<!-- signed: security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 85dde2d commit b617675
6 files changed
Lines changed: 975 additions & 99 deletions
File tree
- .claude/skills/pm-dispatch/references
- lanes
- scripts/pm/fleet-write
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments