Repository navigation
feat(vulnogram-api): add vulnogram-api-record-publish CLI (REVIEW → PUBLIC over API) - #223
Merged
Merged
Conversation
Add a new ``vulnogram-api-record-publish`` command that drives the
``REVIEW`` → ``PUBLIC`` state transition over the OAuth API. The
existing ``vulnogram-api-record-update`` is intentionally
content-only — it writes arbitrary JSON to a record but does not
encode state semantics. This new command is intentionally narrow:
1. Fetch the current stored JSON via the existing ``get_record``
helper.
2. Refuse the transition unless the current state is in the
accepted set (default ``{"REVIEW"}``; ``--allow-state`` widens
it).
3. Set ``CNA_private.state = "PUBLIC"`` (preserving every other
field).
4. POST the modified document via the existing ``update_record``
helper.
Idempotent on records already in ``PUBLIC`` (exits 0 with an
informational message). Refuses unexpected states with exit 3
rather than silently flipping — the safety net for a sync that
re-runs the publish on a tracker that already published.
Driver: the new convention documented in apache#222 (RM-handoff no shell
commands; sync drives the post-advisory close-out). On the
"published archive URL captured" signal the sync skill now runs
this command to drive the CNA-feed dispatch to ``cve.org`` rather
than waiting on a manual Vulnogram UI click. The full
sync-skill-side wiring (label flips, tracker close, wrap-up comment
composition) lands in a follow-up PR.
Tests cover the seven invariants:
- Invalid CVE-ID form rejected before any network call.
- ``PUBLIC`` already → no-op, exit 0, informational stderr.
- Unexpected state → refusal, exit 3, name the observed state.
- ``--allow-state REVIEW --allow-state READY`` widens the
accepted set (verified with a ``READY`` fixture).
- ``--dry-run`` reports the proposed transition without POSTing.
- Apply path flips ``state`` to ``PUBLIC`` and POSTs once.
- ``SessionExpired`` from ``get_record`` returns exit 2.
Stdlib-only — no new runtime deps, consistent with the rest of
``vulnogram-api``.
2 tasks
potiuk
added a commit
that referenced
this pull request
May 18, 2026
… hand-off (#224) Add `tools/vulnogram/release-manager-wrap-up-comment.md` — the template `security-issue-sync` posts AFTER the tracker has been auto-closed at the end of the post-advisory lifecycle close-out (the combined apply on the `Advisory archived on <users-list>` row of Step 2b). By the time this comment posts, sync has already done all of: captured the archive URL, extracted the public short summary into the body, flipped labels (`fix released → announced - emails sent` + `announced`), regenerated and re-pushed the JSON, moved the Vulnogram record `REVIEW → PUBLIC` via the new `vulnogram-api-record-publish` CLI (#223), moved the board to the `Announced` column, and closed the tracker. The wrap-up comment is informational + a tiny ping to the RM with two residual manual steps: 1. Archive the closed tracker from the `Announced` column. 2. (Conditional, last-sibling case only) Close the milestone via the clickable URL the skill substitutes into MILESTONE_BULLET. In the more common "other siblings still open" case the bullet resolves to an empty string and the milestone close happens when the *last* sibling tracker reaches the same step. Marker: `<!-- apache-steward: release-manager-wrap-up v1 -->` — sync uses this for idempotency (the tracker is closed by the time this comment posts; re-posting on a re-sync would just be noise). Companion to #222 (convention update — describes when this comment fires) and #223 (`vulnogram-api-record-publish` — the tool that flips REVIEW → PUBLIC, referenced from the template). The SKILL.md Step 4 hookup (the apply-side code that actually composes the placeholders and posts the comment) lands in a follow-up PR once the agent-procedure for the combined apply is wired through.
1 of 2 tasks
potiuk
added a commit
that referenced
this pull request
May 18, 2026
#225) Complete the post-advisory close-out chain by adding three new action bullets to Step 4 (Apply confirmed changes): 1. Vulnogram state transition (REVIEW → PUBLIC) via the `vulnogram-api-record-publish` CLI from #223. Locked to the "Advisory archived on <users-list>" combined-apply trigger; idempotent on already-PUBLIC records. 2. Advisory short-summary extraction. Fetches the archived advisory email body from lists.apache.org, extracts the prose block between the CVE header and the affected-version-range block, surfaces in the Step 2 proposal so the user can spot misextraction before the body-field update applies. Lands the summary into the *Short public summary for publish* body field BEFORE the Step 5 JSON regen so the re-pushed JSON carries the published summary verbatim. 3. Wrap-up comment (post-close) using the `release-manager-wrap-up-comment.md` template from #224. Posts after the tracker close succeeds. The conditional `MILESTONE_BULLET` placeholder is resolved by a sibling-state check: if every milestone-sibling is closed at this moment, substitute the close-milestone link; otherwise substitute an empty bullet (the milestone close happens when the last sibling tracker reaches this same step). Idempotent via the `<!-- apache-steward: release-manager-wrap-up v1 -->` marker. The orchestration (which action fires in which order) is already documented in #222 on the Step 2b "Advisory archived" row; this PR provides the concrete per-action recipes that the agent reads when executing that combined apply. Closes the upstream side of the no-uv-run-for-RM + sync-drives- lifecycle-close-out arc: - #222: convention + handoff templates - #223: vulnogram-api-record-publish CLI - #224: wrap-up comment template - this PR: Step 4 action recipes that wire it all together
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
vulnogram-api-record-publish— a new CLI that drives theREVIEW → PUBLICstate transition over the OAuth API. Companion to the existingvulnogram-api-record-update(which is content-only) and motivated by the convention update in #222 (RM handoff: no shell commands; sync drives the post-advisory close-out).Why
Before this PR, the
REVIEW → PUBLICtransition was the last manual step in the security lifecycle — a Vulnogram UI button click, intentionally human-only because of the CNA-feed dispatch side effect. The new convention from #222 reverses that: on the "published archive URL captured" signal (the advisory provably shipped on<users-list>),security-issue-syncnow drives the publish over the OAuth API. This PR provides the tool that the sync step calls.Design
Intentionally narrow —
record_publishonly flipsCNA_private.stateto"PUBLIC", preserving every other field. The existingrecord_updateaccepts arbitrary JSON which is the wrong shape for a state-transition (a content edit could smuggle through the publish path).get_record.{"REVIEW"};--allow-statewidens it for cases likeREADY → PUBLIC).CNA_private.state = "PUBLIC".update_record.Idempotent on records already in
PUBLIC(exit 0 with an informational message). Refuses unexpected states with exit 3 — a sync that re-runs the publish on an already-published tracker is a bug, not a no-op.CLI
Exit codes mirror
record_update: 0 success / 2 session expired / 3 unexpected state / 4 CSRF / 5 save failed / 6 other API error / 7 unexpected envelope.Tests
Seven
tests/test_record_publish.pycases, all pass:PUBLIC→ no-op, exit 0.--allow-state REVIEW --allow-state READYwidens the accepted set.--dry-runreports without POSTing.statetoPUBLICand POSTs once with the correct document.SessionExpiredfromget_recordreturns exit 2.Stdlib-only at runtime — consistent with the rest of
vulnogram-api.Relationship to other PRs in this arc
security-issue-syncto actually callvulnogram-api-record-publishon the archive-URL signal, compose the wrap-up comment, flip labels, close the tracker. Lands once feat(security-issue-sync): RM handoff — no shell commands; sync drives full post-advisory close-out #222 + this PR land.Test plan
uv run pytest tests/test_record_publish.pypasses (all 7).uv run ruff format/ruff checkpass (verified via pre-commit).uv run mypypasses (verified via pre-commit).cveprocess.apache.orgdeferred to a follow-up — requires a CVE record inREVIEWstate and an authenticated session; PR author will exercise once feat(security-issue-sync): RM handoff — no shell commands; sync drives full post-advisory close-out #222 lands and the next live advisory is dispatched.