Repository navigation
feat(vulnogram): add OAuth-session API client + propose by default for release-manager paste flow - #69
Merged
Conversation
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>
4 of 5 tasks
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
Adds a new
tools/vulnogram/oauth-api/Python package (mirroringtools/gmail/oauth-draft/) that lets the release manager skip the manual#sourcecopy-paste in the post-allocation Vulnogram workflow. Three console scripts:vulnogram-api-setupcveprocess.apache.orgin a regular browser, copy theconnect.sidvalue via DevTools, paste it back. Stores at~/.config/apache-steward/vulnogram-session.json(mode 0600, parent 0700, atomic write).vulnogram-api-record-update/cve5/<CVE-ID>. Scrapes the per-page CSRF token and sends it viaCSRF-Tokenheader — mirroring Vulnogram's own browser client (actions.js). Maps response envelopes to specific exit codes for skill branching.vulnogram-api-checkvalid/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 installround-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:
Vulnogram/Vulnogram) only ships a LocalStrategy username/password Passport setup. No OAuth, no Bearer tokens.cveprocess.apache.org) is fronted byoauth.apache.orgSSO, 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.cveprocess.apache.org, swapping theCookie:header forAuthorization: Bearer …is a one-file change inclient.py.What changes for the release manager
tools/vulnogram/record.mdand therelease-manager-handoff-comment.mdtemplate now proposevulnogram-api-record-updateby default for the two writes (DRAFT→REVIEWandREVIEW→PUBLIC), with the copy-paste-into-#sourceflow preserved as a documented fallback.The state-transition clicks (
DRAFT→REVIEW,REVIEW→READY,READY→PUBLIC) intentionally stay in the Vulnogram UI. Pre-settingCNA_private.statein the JSON works for the first two, butREADY→PUBLICtriggers CNA-feed dispatch tocve.organd we deliberately do not automate it.Config knob
tools.vulnogram.api_backendin.apache-steward-overrides/user.md:oauth_session(default) — propose API first, copy-paste as fallback.copy_paste— skip the API path entirely.CI
.github/workflows/tests.yml(vulnogram-oauth-api)..pre-commit-config.yaml(ruff check / format / mypy / pytest).SessionExpired, error envelopes, success path), and each CLI's exit-code contract.Test plan
prek run --all-filesgreen againstorigin/main.vulnogram-api-setup→vulnogram-api-check→vulnogram-api-record-updateagainst a realcveprocess.apache.orgtest record on the next CVE the security team handles.Vulnogram/Vulnogram@routes/onedoc.jswas the static evidence; the live POST is still untested).Files
tools/vulnogram/oauth-api/{pyproject.toml,README.md,src/vulnogram_api/*.py,tests/*.py}tools/vulnogram/{record.md,release-manager-handoff-comment.md,tool.md}.claude/skills/{security-cve-allocate,security-issue-sync}/SKILL.md.pre-commit-config.yaml,.github/workflows/tests.yml