Skip to content

feat(vulnogram): add OAuth-session API client + propose by default for release-manager paste flow - #69

Merged
potiuk merged 2 commits into
mainfrom
feat/vulnogram-oauth-api
May 6, 2026
Merged

potiuk merged 2 commits into
mainfrom
feat/vulnogram-oauth-api

Conversation

@potiuk

@potiuk potiuk commented May 6, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new tools/vulnogram/oauth-api/ Python package (mirroring tools/gmail/oauth-draft/) that lets the release manager skip the manual #source copy-paste in the post-allocation Vulnogram workflow. Three console scripts:

Script Purpose
vulnogram-api-setup One-time interactive cookie capture — log into cveprocess.apache.org in a regular browser, copy the connect.sid value via DevTools, paste it back. Stores at ~/.config/apache-steward/vulnogram-session.json (mode 0600, parent 0700, atomic write).
vulnogram-api-record-update POST a CVE JSON to /cve5/<CVE-ID>. Scrapes the per-page CSRF token and sends it via CSRF-Token header — mirroring Vulnogram's own browser client (actions.js). Maps response envelopes to specific exit codes for skill branching.
vulnogram-api-check Read-only probe; reports valid / expired / not-configured (exit 0/1/2). Used by the agentic skills to choose between the API path and the copy-paste fallback.

Stdlib-only at runtime — no third-party deps, so no uv pip install round-trip on a release-manager machine the one time per quarter they bump a CVE record.

"OAuth"?

The directory name follows the user-facing language for the workflow ("ASF OAuth"), but the actual mechanism is session-cookie-after-OAuth-SSO:

  • Upstream Vulnogram (Vulnogram/Vulnogram) only ships a LocalStrategy username/password Passport setup. No OAuth, no Bearer tokens.
  • The ASF deployment (cveprocess.apache.org) is fronted by oauth.apache.org SSO, which sets a server-side session cookie on the Vulnogram host after a successful ASF login. That cookie authorises every subsequent request — UI and any API call this tool makes.
  • If ASF Infra ever adds a real Bearer-token API to cveprocess.apache.org, swapping the Cookie: header for Authorization: Bearer … is a one-file change in client.py.

What changes for the release manager

tools/vulnogram/record.md and the release-manager-handoff-comment.md template now propose vulnogram-api-record-update by default for the two writes (DRAFT → REVIEW and REVIEW → PUBLIC), with the copy-paste-into-#source flow preserved as a documented fallback.

The state-transition clicks (DRAFT → REVIEW, REVIEW → READY, READY → PUBLIC) intentionally stay in the Vulnogram UI. Pre-setting CNA_private.state in the JSON works for the first two, but READY → PUBLIC triggers CNA-feed dispatch to cve.org and we deliberately do not automate it.

Config knob

tools.vulnogram.api_backend in .apache-steward-overrides/user.md:

  • oauth_session (default) — propose API first, copy-paste as fallback.
  • copy_paste — skip the API path entirely.

CI

  • New matrix entry in .github/workflows/tests.yml (vulnogram-oauth-api).
  • Four new prek hooks in .pre-commit-config.yaml (ruff check / format / mypy / pytest).
  • 37 unit tests cover credentials I/O, the HTTP client (CSRF scrape, redirect → SessionExpired, error envelopes, success path), and each CLI's exit-code contract.

Test plan

  • prek run --all-files green against origin/main.
  • 37 unit tests pass.
  • After merge, manually exercise vulnogram-api-setup → vulnogram-api-check → vulnogram-api-record-update against a real cveprocess.apache.org test record on the next CVE the security team handles.
  • Document the manual smoke-test result in a follow-up comment so we know the API path actually works against the live ASF instance (route inspection of Vulnogram/Vulnogram@routes/onedoc.js was the static evidence; the live POST is still untested).

Files

  • New: tools/vulnogram/oauth-api/{pyproject.toml,README.md,src/vulnogram_api/*.py,tests/*.py}
  • Modified docs: tools/vulnogram/{record.md,release-manager-handoff-comment.md,tool.md}
  • Modified skills: .claude/skills/{security-cve-allocate,security-issue-sync}/SKILL.md
  • Modified CI: .pre-commit-config.yaml, .github/workflows/tests.yml

Add a `tools/vulnogram/oauth-api/` Python package that lets the
release manager skip the manual `#source` paste in the post-
allocation Vulnogram workflow. Three console scripts, mirroring
the layout of `tools/gmail/oauth-draft/`:

- `vulnogram-api-setup` — interactive cookie capture: walk the
  operator through logging into `cveprocess.apache.org` in a
  regular browser, copying the `connect.sid` value via DevTools,
  and pasting it back into the script. Stores the session JSON
  at `~/.config/apache-steward/vulnogram-session.json`
  (mode 0600, parent dir 0700; atomic write via tempfile +
  `os.replace`).
- `vulnogram-api-record-update` — POSTs a CVE JSON to
  `/cve5/<CVE-ID>`. Scrapes the per-page CSRF token from the
  rendered editor page and sends it via the `CSRF-Token` header,
  mirroring what Vulnogram's own browser client does. Maps the
  response envelope to specific exit codes (2 = session expired,
  4 = CSRF-not-found, 5 = save failed, etc.) so the agentic
  skills can branch deterministically.
- `vulnogram-api-check` — read-only probe that reports
  `valid` / `expired` / `not-configured` (exit 0/1/2). Used by
  `security-cve-allocate` and `security-issue-sync` to decide
  whether to propose the API path or fall back to copy-paste.

Stdlib-only at runtime — no third-party deps, no extra `uv pip
install` round-trip on a release-manager's machine the one time
per quarter they bump a CVE record.

Why "OAuth" but no Bearer token: upstream Vulnogram only ships
a LocalStrategy username/password Passport setup; the ASF
deployment is fronted by `oauth.apache.org` which sets a server-
side session cookie on `cveprocess.apache.org` after a successful
ASF SSO login. That cookie authorises every subsequent request,
so the same cookie authorises the API calls the tool makes. If
ASF Infra ever adds a real Bearer-token API to
`cveprocess.apache.org`, swapping the `Cookie:` header for
`Authorization:` is a one-file change in `client.py`.

`tools/vulnogram/record.md` and the
`release-manager-handoff-comment.md` template are updated so the
*Release-manager checklist* now proposes `vulnogram-api-record-update`
**by default** for the two writes (`DRAFT` → `REVIEW` and
`REVIEW` → `PUBLIC`), with the copy-paste-into-`#source` flow
preserved as a documented fallback. The state-transition clicks
(`DRAFT` → `REVIEW`, `REVIEW` → `READY`, `READY` → `PUBLIC`)
intentionally stay in the Vulnogram UI; pre-setting
`CNA_private.state` in the JSON works for the first two but the
`READY` → `PUBLIC` push triggers CNA-feed dispatch to `cve.org`
and we deliberately do not automate it.

A `tools.vulnogram.api_backend` config knob in
`.apache-steward-overrides/user.md` lets adopters opt out
(`copy_paste`); default is `oauth_session`.

CI: matrix entry in `.github/workflows/tests.yml` plus four
prek hooks (ruff check / format / mypy / pytest) wired in
`.pre-commit-config.yaml`. 37 unit tests cover credentials I/O,
the HTTP client (CSRF scrape, redirect → SessionExpired, error
envelopes, success path), and each CLI's exit-code contract.

Generated-by: Claude Code (Claude Opus 4.7)
…ring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@potiuk
potiuk merged commit 67a3cb2 into main May 6, 2026
12 checks passed
@potiuk
potiuk deleted the feat/vulnogram-oauth-api branch May 6, 2026 15:04
@andreahlert andreahlert added the mode:Triage Agentic Triage — spot, classify, route, surface duplicates label May 7, 2026
@potiuk potiuk added the contract:cve-authority Tool capability: CVE allocation / record management / publication label Sep 25, 2026
@zeroshade zeroshade mentioned this pull request Oct 13, 2026
4 of 5 tasks
@potiuk potiuk added capability:intake Import external signal + sync tracker state capability:resolve Close-out: invalidate, dedupe, CVE allocate, announcement family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:security security-* skills family:tools tools/* labels Nov 1, 2026
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:resolve Close-out: invalidate, dedupe, CVE allocate, announcement contract:cve-authority Tool capability: CVE allocation / record management / publication family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:security security-* skills family:tools tools/* mode:Triage Agentic Triage — spot, classify, route, surface duplicates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants