Skip to content

feat(vulnogram-api): add vulnogram-api-record-publish CLI (REVIEW → PUBLIC over API) - #223

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:sync-auto-publish-implementation
May 18, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:sync-auto-publish-implementation

Conversation

@potiuk

@potiuk potiuk commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

Add vulnogram-api-record-publish — a new CLI that drives the REVIEW → PUBLIC state transition over the OAuth API. Companion to the existing vulnogram-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 → PUBLIC transition 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-sync now drives the publish over the OAuth API. This PR provides the tool that the sync step calls.

Design

Intentionally narrow — record_publish only flips CNA_private.state to "PUBLIC", preserving every other field. The existing record_update accepts arbitrary JSON which is the wrong shape for a state-transition (a content edit could smuggle through the publish path).

  1. Fetch the current stored JSON via get_record.
  2. Refuse the transition unless the current state is in the accepted set (default {"REVIEW"}; --allow-state widens it for cases like READY → PUBLIC).
  3. Set CNA_private.state = "PUBLIC".
  4. POST via 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

vulnogram-api-record-publish --cve-id CVE-YYYY-NNNNN [--allow-state STATE]* [--dry-run]

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.py cases, all pass:

  • Invalid CVE-ID form → rejected pre-network.
  • Already PUBLIC → no-op, exit 0.
  • Unexpected state → refusal with the observed state name, exit 3.
  • --allow-state REVIEW --allow-state READY widens the accepted set.
  • --dry-run reports without POSTing.
  • Apply path flips state to PUBLIC and POSTs once with the correct document.
  • SessionExpired from get_record returns exit 2.
$ uv run pytest tests/test_record_publish.py
.......                                                                  [100%]
7 passed in 0.03s

Stdlib-only at runtime — consistent with the rest of vulnogram-api.

Relationship to other PRs in this arc

Test plan

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``.
@potiuk
potiuk merged commit 6046fba into apache:main May 18, 2026
13 checks passed
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.
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
@potiuk potiuk added the contract:cve-authority Tool capability: CVE allocation / record management / publication label Sep 25, 2026
@potiuk potiuk added the family:tools tools/* label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:cve-authority Tool capability: CVE allocation / record management / publication family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant