diff --git a/docs/ADRs/0169-assess-vulnerabilities-with-a-read-only-agent-before-the-code-agent.md b/docs/ADRs/0169-assess-vulnerabilities-with-a-read-only-agent-before-the-code-agent.md new file mode 100644 index 0000000000..6f66406e09 --- /dev/null +++ b/docs/ADRs/0169-assess-vulnerabilities-with-a-read-only-agent-before-the-code-agent.md @@ -0,0 +1,243 @@ +--- +title: "169. Assess vulnerabilities with a read-only agent before the code agent" +status: Accepted +relates_to: + - agent-architecture + - security-threat-model +topics: + - agents + - vulnerability-management + - coordination +--- + +# 169. Assess vulnerabilities with a read-only agent before the code agent + +Date: 2026-11-11 + +## Status + +Accepted + + + +## Context + +Teams want fullsend to handle vulnerability work: a CVE arrives as a tracker, +an alert or an issue, someone decides whether it affects a repository, and if +it does, someone fixes it. Many findings need no code change, because the +component is absent, the fix is already carried or the vulnerable code cannot +be reached. The result is then a justified "not affected" on the tracker, not +a pull request. No built-in agent produces that result: triage labels and +routes an issue, and code writes a change. + +The [CVE workflow experiment](https://github.com/fullsend-playground/cve-workflow-experiment) +showed the flow can work. It composes the triage harness with its own agent, +result schema and scripts, registers that under the `triage` name, and keeps +a controller in the repository. A second repository would have to copy that +code, and a repository that adopts it no longer has regular triage. Dispatch +to several targets and recovery for this work are being decided separately +([#9266](https://github.com/fullsend-ai/fullsend/pull/9266), +[#9264](https://github.com/fullsend-ai/fullsend/pull/9264)). Selecting Pi +extension tools is proposed in +[#9265](https://github.com/fullsend-ai/fullsend/pull/9265). + +Each step gets its own agent, harness and sandbox +([ADR 0020](0020-composable-single-responsibility-agents-with-individual-sandboxes.md)), +any harness may name any existing role +([ADR 0124](0124-criteria-for-adding-a-built-in-agent-role.md)), and runs are +serialized per harness and work item +([ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md)). +This ADR aims to give any repository a trustworthy verdict on one public +vulnerability for one branch, and a fix where one is needed, without +orchestration code of its own. + +## Options + +### Where assessment runs + +- **A skill on the code agent.** The smallest change. The code agent's output + is a pull request and its role can write code, so every assessment, + including the many that end in "not affected", would run with write access + and have nowhere to put its answer. +- **The triage agent, extended or composed.** Triage has the right role. + Extending it adds a verdict to a result every adopter shares, on a time + budget sized for labelling an issue. Composing over it, as the experiment + does, replaces regular triage for the repository. +- **A Pi extension that holds the whole workflow.** It works on one runtime, + which the adopter chooses per agent + ([ADR 0091](0091-per-agent-runtime-model-effort.md)), and the checks that + gate publishing and coding would run inside the sandbox. This option is + about where the workflow lives. An extension that collects evidence as a + tool inside a run is allowed (item 8). +- **A read-only assessment agent, then the code agent.** Chosen. + +### How a work item reaches the agent + +- **Triage first.** Triage runs on the work item, recognises a + vulnerability and adds the label that starts the `cve` agent. This works + on any tracker and catches a vulnerability reported as an ordinary bug. + But triage reads the whole work item into a model before any check that + the finding is public, every tracker costs a triage run before its + assessment, and triage's outcomes do not fit a tracker + ([agents#1967](https://github.com/fullsend-ai/agents/issues/1967)). +- **A label or a command from a person.** This works on every forge and + keeps a person on the choice to assess. Triage has usually run by the + time anyone adds the label. +- **The issue type.** A work item whose type marks it as a vulnerability + skips triage and starts the `cve` agent, so no model reads it before the + host checks. Today only Jira events carry an issue type, a type's id and + name belong to the Jira site, and changing only the type of an open work + item raises no event. Chosen where the tracker has such a type, with the + label and the command for everything else. + +## Decision + +We add a first-party `cve` agent that assesses one public vulnerability +against one branch and changes nothing, and we hand any fix to the existing +code agent, so that assessment needs no write access to code and a fix +always follows a verdict. + +1. **Role.** The agent uses the existing `triage` role with a read-only + checkout. It adds no role and no scope, so ADR 0124 is not engaged. It + lives in `fullsend-ai/agents`, a repository registers it with an + `agents:` entry ([ADR 0058](0058-agent-registration.md)), and its harness + trigger dispatches it ([ADR 0061](0061-harness-cel-dispatch.md)). +2. **Start.** Where events carry an issue type, a work item of a + vulnerability type starts the agent when it is opened, and triage does + not start on it. The `cve` and triage triggers match the type by its + id, because a site can rename a type and the id stays the same. The ids + belong to the tracker's site, so an adopter sets them by changing those + triggers on its `agents:` entries + ([ADR 0162](0162-agent-entries-may-carry-harness-overrides.md)). + Everywhere else, and for a work item that is already open, the agent + starts on a `/fs-cve-triage` comment from a person or when the + `fullsend-cve` label is added, and triage does not start on a work item + with that label. Whether a work item of a vulnerability type should + instead wait for a person's comment before its first assessment, so that + nothing is assessed by default, is not decided here. +3. **Verdict.** The result is affected, not affected, fixed or under + investigation, in the terms of CSAF VEX, and each piece of evidence says + whether a tool observed it or the model judged it. Host scripts publish + each run's verdict as a new comment on the work item and do not edit an + earlier one + ([#9334](https://github.com/fullsend-ai/fullsend/issues/9334)). It is a + proposal for a person to review; fullsend does not publish VEX. A run + that cannot gather its evidence, for example because the sandbox lacks + the toolchain the branch declares, says so and gives no verdict. +4. **Handoff.** An affected verdict records on the work item the + vulnerability, the branch, the commit and the files its plan may change. + Host scripts write that record, and a later assessment replaces it. + Where the tracker can hold structured data on a work item, the record is + kept there and not in comment text. Where it can only be a comment, the + host check accepts only a comment written by fullsend's own identity, + because authorizing the actor who starts a run does not authorize other + content on the work item + ([Authorization Contract v2](../normative/authorization/v2/README.md)). + The code agent works on a vulnerability only while that record is current. + It opens its change against the assessed branch + ([ADR 0053](0053-agent-driven-branch-targeting.md)), and a host check + rejects a change outside those files. On a vulnerability work item the + code agent starts only on a person's `/fs-code` comment; the + `ready-to-code` label does not start it there. The fix agent is held to + the same record and the same files, and a change that needs other files + needs a new assessment. +5. **One target per run.** Host scripts resolve one repository and branch + for the work item. They use structured data on the work item (the + vulnerability, product, release and component), which is either the + tracker's own fields or an intake record set on the work item, and a + release mapping the adopter keeps in its repository, not the work item's + free text. When that data is missing or ambiguous, or the release has no + mapping, the run stops with a reason; it does not choose a repository + and does not report not affected. Who writes an intake record, where one + is used, is not decided here. Several maintained branches are several + work items. How those are created is not decided here; #9266 proposes + one. +6. **Scope.** Embargoed vulnerabilities are out of scope. Host scripts stop + a run that cannot show its finding is public, before a sandbox exists. + A work item that carries a tracker security level counts as not public + unless the adopter lists that level as readable. Whether a private + tracker's text may be used for a public repository is also not decided + here (see + [private context in public agent workflows](../problems/private-context-public-workflows.md)); + until it is, the agent by default does not read that text in that case. + When the tracker is private and the repository is public, the change + the code agent proposes, its commits included, carries only public facts: + the vulnerability's identifier, its public advisory and the assessed + commit. It carries no link to the work item and no text from it. +7. **Adopter facts.** The release mapping with its maintained branches, + vendor VEX sources, readable tracker security levels and label + conventions live in files in the adopter's repository. A harness setting + names those files + ([ADR 0162](0162-agent-entries-may-carry-harness-overrides.md)). They are + not new `config.yaml` fields. +8. **Tools.** Tools the agent calls during a run, MCP servers included, + execute inside its sandbox, under its network policy and an allow-list + of tools. The sandbox is given no credential that can change code, and + publishing stays in host scripts. A tool that collects evidence, a + runtime extension included, is such a tool. It covers the ecosystems it + was written for and may work on one runtime only, so a run it does not + cover gathers its evidence without it or ends without a verdict (item + 3). A tool server that has to run outside the sandbox with its own + access to the checkout is a platform decision this ADR does not make. + +## Forge scope + +- **GitHub:** issues are the work item, including one opened from a + Dependabot alert. An alert that has no work item is not in this ADR's + scope: reading alerts, assessing one before a work item exists and + opening the work item are not decided here. +- **GitLab:** covered as the repository, with Jira as the tracker. GitLab + issues as the work item are not covered yet, because no adopter files + vulnerability trackers there; the agent skips them with a reason. +- **Jira:** Cloud trackers reach the agent through the Jira poller + ([ADR 0063](0063-polling-based-work-discovery.md)). Its events are the + only ones that carry an issue type today. +- **Agent job on one forge, repository on another:** not covered. A GitLab + job has assessed a GitHub repository, and the code agent then changed it, + but only with adopter-side scripts and a credential kept as a CI/CD + variable ([#9577](https://github.com/fullsend-ai/fullsend/issues/9577), + [#402](https://github.com/fullsend-ai/fullsend/issues/402)). A pull + request opened that way raises no event where the job ran, so it is + reviewed only if fullsend is also installed on the repository. +- **Forgejo:** fullsend has no Forgejo support yet; nothing to change. + +## Consequences + +- A repository gets vulnerability assessment by registering one agent, and a + justified "not affected" needs no write access to code. +- The triage and code harnesses each gain a condition, so a vulnerability + work item reaches a verdict before either acts on it. +- A vulnerability reported as an ordinary issue, with no vulnerability type + and no label, still goes to triage. Having triage hand it to the `cve` + agent is not decided here. +- A fix takes two runs with a person between them by default, which is slower + than one run and keeps a person on the verdict. +- The check that holds a change to the verdict's plan is built for the code + agent only. The fix agent, which acts on review findings, needs the same + check before it is enabled on these changes. When the change is on + another forge than the work item, the fix agent's run also needs a way + to read the record. +- The adopter keeps the release mapping. Where the tracker's own fields do + not carry the vulnerability, release and component, something has to + write the intake record. Opening one work item per maintained branch + also stays with the adopter until a later decision. +- Nothing checks yet that a change proposed on a public repository carries + only public facts. That host check is needed before the code agent works + from a private tracker on a public repository. +- Where a site puts a security level on every vulnerability tracker, the + agent does not run until the adopter lists a level as readable. +- One vulnerability can have many trackers, and several can map to the same + branch and commit. Each is assessed on its own. Reusing a verdict for the + same vulnerability, repository, branch and commit is left to a later + decision. +- An assessment needs the toolchain its branch declares, and the maintained + branches of one repository can declare different versions. The agent + image carries one version of each toolchain, so a run on a branch that + needs another can end without a verdict. + [#9395](https://github.com/fullsend-ai/fullsend/pull/9395) proposes + composing images into a sandbox. diff --git a/docs/architecture.md b/docs/architecture.md index 727fbd9177..826bd2ad56 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -797,6 +797,7 @@ the inheritance model: fullsend defaults, then repo baseline (`config.base.yaml` - Config lookup: config entries are looked up directly via `findConfigAgentEntry`; the agents-repo fallback operates independently when the agent is not found in config. Builds on [ADR 0045](ADRs/0045-forge-portable-harness-schema.md) harness identity model. - CLI management: `fullsend agent add|list|set|update|remove` manages config entries and auto-pins URLs to a commit SHA with an integrity hash. - Agent generation: `fullsend agent new ` writes a complete custom agent — harness, agent definition, result schema, post-script, and the base policy a per-repo install does not vendor; its built-in providers are bare names whose definitions and profiles come from the `fullsend` binary — validates it with the loader dispatch uses, and registers it through the `agent add` path above. A `trigger:` is mandatory, because a trigger-less harness registers and validates and is then silently never dispatched; `--role` is a closed table of the roles the hosted mint serves, so an unservable role fails locally rather than as a `403` at first dispatch ([ADR 0102](ADRs/0102-generate-custom-agents-from-the-cli.md)). +- Decided, not yet implemented: a first-party `cve` agent in `fullsend-ai/agents` assesses one public vulnerability against one branch with the `triage` role and a read-only checkout, and publishes a verdict for a person to review. A work item of a vulnerability type starts it and skips triage; elsewhere a person's command or a label does. A fix is handed to the code agent, which starts on a person's `/fs-code` comment and works only from a current "affected" verdict and within the files that verdict's plan names ([ADR 0169](ADRs/0169-assess-vulnerabilities-with-a-read-only-agent-before-the-code-agent.md)). - Functional tests: agent functional tests live in fullsend-ai/agents, not in this repo. The fullsend release gate runs the release tier (each agent's `release: true` case), and the full tier runs nightly in the agents repo against fullsend `main` ([ADR 0139](ADRs/0139-agent-functional-test-suite-lives-in-agents-repo.md), superseding [ADR 0052](ADRs/0052-functional-tests-for-agent-pipelines.md)'s `eval/` layout). **Open questions:** diff --git a/docs/problems/agent-architecture.md b/docs/problems/agent-architecture.md index 80d7f4d206..97cc069ff0 100644 --- a/docs/problems/agent-architecture.md +++ b/docs/problems/agent-architecture.md @@ -113,6 +113,14 @@ Some bugs sit between the two categories — the pattern is somewhat mechanical This is more expensive than either pure approach but avoids both the blast radius of incorrect broad fixes and the amnesia of purely narrow fixes. +### Vulnerability assessment agent + +Decides whether one public vulnerability affects one branch of a repository, and proposes a plan when it does. Many findings need no code change, so its main output is a justified verdict on the tracker. + +- **Authority:** Comment and label on the work item; hand an affected verdict to the code agent +- **Does not have:** Write access to code +- **Decided:** a read-only `cve` agent assesses before the code agent acts, and a work item of a vulnerability type goes to it without passing through triage ([ADR 0169](../ADRs/0169-assess-vulnerabilities-with-a-read-only-agent-before-the-code-agent.md)). Writing the intake record that names the product and release, opening one work item per maintained branch, and an agent job on one forge with the repository on another remain open. + ### Backlog/priority agent Determines what should be worked on next based on priority, urgency, and available capacity.