Skip to content

feat(security): security-tracker contract with local-files and private Jira backends - #1647

Merged
potiuk merged 2 commits into
apache:mainfrom
potiuk:security-tracker-backends
Oct 16, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
potiuk:security-tracker-backends

Conversation

@potiuk

@potiuk potiuk commented Oct 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Why. The security skills assume the tracker is a private GitHub repository. Teams that keep reports as Markdown files in a private SVN area or repository, or that triage in Jira, had no way in.
  • What. A new contract:security-tracker (tools/security-tracker/) with two new backends next to GitHub, selected by tracker.platform (default github, so existing adopters see no change):
    • local-files — tools/local-tracker/: reports as Markdown in a private Git or SVN working copy. detect learns the format of the reports already in the folder (layout, ID pattern, metadata style and keys, state values or state folders, heading level, comments) and commits it as .magpie-tracker.json; with no reports a documented default applies. Writes are refused until a human confirms the repository is access-restricted. A session that wrote to the tracker ends with a commit-and-push proposal; publish commits only the tracker folder (and pushes on Git; on SVN the commit is the publish).
    • jira — magpie-jira-tracker in tools/jira/: a Jira project whose issues carry an issue-security level. create always sets the level; every write on an issue without one is refused. Built on the existing jira_bridge.rest client, which gains a write path (send()) under the same host-bound-token rules and refuses writes when the token was withheld.
  • How skills reach it. Through vetted operations only. The contract maps every tracker gh command the security skills use to a vetted operation; vetted-ops translates it for the backend named in its [tracker] policy (fixed program, policy-pinned target, bodies on stdin) and refuses by name the operations with no counterpart (boards, milestone admin, roster, rollup-fold). Six operations give every tracker shape a vetted form: issue-create, issue-reopen, issue-list-label, issue-search, tracker-pending, tracker-publish. A shared block in the 12 tracker-touching security skills routes them; /magpie-setup config Step 3a picks the backend, runs detect, and asks the access question.

Design and plan: docs/designs/2026-10-15-security-tracker-backends.md.

Type of change

  • Skill change — shared tracker-backend block in 12 security skills; setup config Step 3a
  • Tool / bridge contract (tools/security-tracker/contract.md)
  • Python package (tools/local-tracker, tools/jira, tools/vetted-ops)
  • Groovy reference impl
  • Cross-cutting (vetted-ops command surface)
  • Documentation (design, plan, capability taxonomy, spec)
  • Project template (tracker.platform, tracker.local.*, tracker.jira.*)
  • CI / dev loop (validator taxonomy, vendor-neutrality policy, labeler)

Test plan

  • prek run --all-files passes (after rebasing on main)
  • tools/local-tracker: 16 tests, incl. real Git (bare remote) and SVN (svnadmin) commit-and-push; ruff, mypy clean
  • tools/jira: Python tests pass (REST client incl. the new send() token rules; 58 security-tracker CLI + markup tests); Groovy tests skip without Groovy, as before
  • tools/vetted-ops: full suite passes, incl. a test that derives the tracker operations from the catalogue and fails if any is neither translated nor refused, and an end-to-end run through vetted-ops against the real local tracker
  • Eval suites for the 12 affected skills (self-eval): 308/313. The 5 failures read prompts this PR does not change — import-from-md step 1 case-4 (findings-format.md), issue-fix step 7 case-1 (Step 7 text byte-identical to main), issue-import step 2b case-4 and step 5 case-3 (screening-and-proposal.md), issue-sync GHSA case-5 (github-advisory.md); the two I re-ran failed identically, so they are pre-existing on main.
  • Cross-model eval pass — not run yet
  • Pilot on a real SVN-files project and a real Jira project — not done yet

RFC-AI-0004 compliance

  • HITL — local publish (commit + push) only on explicit confirmation; setup writes the descriptor and the vetted-ops [tracker] table only on confirmation
  • Sandbox — no new unrestricted access; backends run through vetted-ops' fixed argv; tracker-publish is the one new operation on vetted-op-tracker
  • Vendor neutrality — placeholders throughout; contract has a vendor-agnostic and an Atlassian backend besides GitHub
  • Conversational + correctable — detected format is shown with its evidence before it is written, and is a plain JSON file a human can fix
  • Write-access discipline — no autonomous outbound messages
  • Privacy LLM — no new LLM hop

Linked issues

Refs #301 (Jira write support).

Notes for reviewers

  • Confidentiality guard. Every backend refuses to write to a tracker it cannot show is restricted: Jira checks the issue-security level on every write; local files refuse until a human-confirmed access_restricted: true, and doctor fails on a public GitHub remote. Worth a careful read in tools/jira/src/jira_bridge/security_tracker.py and tools/local-tracker/src/magpie_local_tracker/store.py.
  • vetted-ops. tracker_backends.py is the translation; the policy supplies only data (the backend's tool directory, which must be the one the platform names, and its target), never a command. issue-search refuses : so a repo: qualifier cannot re-target it, and ends options with --.
  • Jira. The first cut was a separate tools/jira-security-tracker/; after rebasing on main (which added jira_bridge.rest) it is folded into tools/jira so there is one client and one credential rule. That is the second commit.
  • The installed vetted-ops copy (~/.claude/magpie/vetted-ops) needs refreshing (setup-isolated-setup-update) before the new operations work in a sandboxed session.

Gen-AI disclosure: prepared with the assistance of Claude Code (Claude Opus 5); reviewed by the author.

🤖 Generated with Claude Code

…e Jira backends

The security skills assumed the tracker is a private GitHub repository.
Teams that keep reports as Markdown files in a private SVN area or
repository, or that triage in Jira, had no way in.

Add contract:security-tracker (tools/security-tracker/) with two new
backends behind it:

- tools/local-tracker/ (magpie-local-tracker): reports as Markdown files
  in a private Git or SVN working copy. `detect` learns the format of the
  reports already in the folder (layout, ID pattern, metadata style and
  keys, state values or state folders, heading level, comments) and
  commits it as .magpie-tracker.json; with none, a documented default
  applies. Writes are refused until a human confirms the repository is
  access-restricted. `pending` / `publish` commit only the tracker folder,
  and push on Git.
- tools/jira-security-tracker/ (magpie-jira-tracker): a Jira project whose
  issues carry an issue-security level. `create` always sets the level,
  and every write on an issue without one is refused.

Skills reach every backend through vetted operations. The contract maps
each tracker `gh` command the skills use to a vetted operation, and
vetted-ops translates it for the backend its `[tracker]` policy names:
fixed program, policy-pinned target, bodies on stdin, unmapped operations
refused by name. Six operations give every tracker shape a vetted form:
issue-create, issue-reopen, issue-list-label, issue-search,
tracker-pending and tracker-publish.

A shared block in the 12 tracker-touching security skills routes them,
and ends a local-files session with a commit-and-push proposal.
`/magpie-setup config` Step 3a picks the backend, detects the existing
format and asks the access question. `tracker.platform` defaults to
`github`, so existing adopters see no change.

Design: docs/designs/2026-10-15-security-tracker-backends.md
Generated-by: Claude Opus 5
tools/jira gained a Python REST client (jira_bridge.rest) that binds the
token to a host the user confirmed, sends it only to that host over
https, and refuses redirects. The Jira security tracker shipped its own
HTTP client without those rules. Keep one client and one Jira tool.

- jira_bridge.rest: JiraRest gains `user` (Basic user:token encoding, as
  bridge.groovy does) and `send()`, the one write path. `send()` applies
  every token rule and refuses any non-GET request when the token was
  withheld, so a write never goes out anonymously or to a re-pointed URL.
- The security tracker moves in as jira_bridge.security_tracker,
  tracker_client and markup; `magpie-jira-tracker` is now a tools/jira
  script. Its credentials are JiraRest's: JIRA_API_TOKEN or
  ~/.config/apache-magpie/jira-token, with JIRA_API_HOST or a host= line.
- tools/jira-security-tracker/ is removed; vetted-ops, the contract, the
  capability docs, the spec and the design point at tools/jira.

Generated-by: Claude Opus 5
@potiuk potiuk added family:security security-* skills family:setup setup-* skills family:tools tools/* contract:security-tracker Tool capability: security-tracker backend for embargoed reports (GitHub / files / Jira) labels Oct 16, 2026
@github-actions github-actions Bot added family:docs Docs, MISSION.md, READMEs family:ci .github workflows, prek, validators capability:triage Sweep + classify + propose disposition capability:fix Implement code change to resolve an issue capability:intake Import external signal + sync tracker state capability:resolve Close-out: invalidate, dedupe, CVE allocate, announcement capability:stats Read-only dashboards, metrics, governance evidence capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) contract:tracker Tool capability: issue / board / label backend substrate:analytics Tool substrate: read-only metrics / dashboards / renderers substrate:sandbox Tool substrate: agent isolation, egress control, settings audit substrate:framework-dev Tool substrate: build / validate / eval the framework itself contract:people labels Oct 16, 2026
@potiuk
potiuk merged commit d91bb8e into apache:main Oct 16, 2026
59 checks passed
potiuk added a commit that referenced this pull request Oct 17, 2026
#1683)

* fix(security-tracker): harden the local and Jira backends after review

The security-tracker backends merged in #1647 without the fixes from its
last review rounds. This carries them forward and closes the findings of
the final review that were still open.

Local-files tracker (git run outside the sandbox through vetted-ops):
- publish pushes `HEAD:<branch>` to exactly the remote and ref it
  checked, with --no-follow-tags, so push.default=matching, a remote's
  push refspecs or push.followTags cannot send other branches or tags;
- git reads attributes from the empty tree (GIT_ATTR_SOURCE), so no
  .gitattributes can switch on a filter, diff or merge driver even if
  one is configured after the per-command config check;
- network-only pushes, no gc/maintenance hooks, and a tree comparison
  against the destination (from the earlier rounds);
- descriptor names may contain spaces (`in progress`), still one path
  component; a bare number naming two reports is ambiguous, and
  underscore slugs resolve by their bare ID;
- inline lists split on real item boundaries (apostrophes, escapes);
- comment-marker authors are percent-encoded, so names with spaces
  read back.

Jira tracker and setup:
- a fence closes only on a matching fence of the same character and at
  least the same length, so a longer block cannot expose PoC headings;
- the CLI takes an explicit --deployment, which vetted-ops always
  passes, so an inherited JIRA_DEPLOYMENT cannot switch a Server tracker
  to Cloud endpoints;
- fresh setup scaffolds `tracker.platform: TODO`, so the backend
  question is asked; the Jira steps map labels to whitespace-free names
  and require `doctor` to pass.

The plugin's copy of the vetted-ops sources and README is brought back in
line with tools/vetted-ops.

Generated-by: Claude Opus 5

* fix(security-tracker): ship the backends in the plugin; code-aware CVE fields

- The jira and local-tracker backends reached the vetted-ops plugin as
  symlinks out of the plugin root, which a self-contained install
  (Codex, a plugin cache) does not carry. They are now generated copies,
  like vetted-ops itself, through the plugin generator's `copies` table.
  The plugins member's ruff run skips the jira copy, whose source is
  checked under its own settings in tools/jira.
- generate-cve-json read a `### <field>` heading even inside a code
  block, so a PoC quoting `### CVE tool link` with an example CVE ID
  before the real field supplied that ID. Field extraction and the
  attachment splice now skip Markdown fences (matching character and
  length) and Jira {code}/{noformat} blocks, for bodies from any
  tracker.

Generated-by: Claude Opus 5

* fix(generate-cve-json): code blocks cannot merge a private field into a public one

The code-aware field parser let reporter text hide later field headings:
an unclosed fence, a fence closed in a later field, or a line-leading
Jira macro in the public summary made it absorb the following fields,
including the private security-thread URL, into the public CVE
description.

Field boundaries follow the body-field contract again: every `###`
line splits fields. The one exception is a `### X` line inside a code
block that both opens and closes when field X also has a heading outside
every code block, which is a PoC quoting a field, not the field. A
heading with no counterpart outside code stays a boundary even inside a
block, so a field can only ever be shorter than the old split, never
longer. Jira blocks open only on a line that starts with the macro, so
an inline `{code}` mention is just text.

Generated-by: Claude Opus 5

* fix(generate-cve-json): field boundaries never depend on code blocks

Dropping a quoted heading as a boundary still lengthened the field before
it: an unfenced fake `### Security mailing list thread` earlier in the
report made the real heading inside a spanning fence look like a quote,
and the public summary absorbed the private thread URL.

Every `###` line now ends a field, as the body-field contract says, so a
value is always exactly one section of that split. Code blocks only pick
which `### <heading>` starts the requested field: the first one outside
every closed block, else the first, so a PoC quoting `### CVE tool link`
inside a fence is still not taken for the field.

Generated-by: Claude Opus 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:fix Implement code change to resolve an issue capability:intake Import external signal + sync tracker state capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) capability:resolve Close-out: invalidate, dedupe, CVE allocate, announcement capability:stats Read-only dashboards, metrics, governance evidence capability:triage Sweep + classify + propose disposition contract:people contract:security-tracker Tool capability: security-tracker backend for embargoed reports (GitHub / files / Jira) contract:tracker Tool capability: issue / board / label backend family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:security security-* skills family:setup setup-* skills family:tools tools/* substrate:analytics Tool substrate: read-only metrics / dashboards / renderers substrate:framework-dev Tool substrate: build / validate / eval the framework itself substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant