> ## Documentation Index
> Fetch the complete documentation index at: https://docs.augmentcode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Vulnerability Remediation

> Build a Cosmos Expert that turns vulnerability reports into fixes backed by build, test, and scan evidence.

A Vulnerability Remediation Expert can deliver a reviewable pull request (PR) or a hardened container image that includes the fix. The Expert shares build, test, and scan results so the team can see how the fix was verified.

## Set up the Expert

Start with one team and one supported repository or container image. Use the [Expert configuration guide](https://docs.augmentcode.com/cosmos/experts-configure-custom.md) to set up the workflow.

| Configure | What to define |
| - | - |
| Intake | A vulnerability ID (such as a CVE) or advisory, the affected image or library and version if known, and a link to the original ticket or thread. |
| How work starts | Keep manual launch available. Optional [scoped triggers](https://docs.augmentcode.com/cosmos/config-triggers.md) can start a run when a designated label is present at ticket creation or is newly added, when a new top-level message appears in a designated Slack channel, or on a schedule that checks for existing findings. Route other ticket updates and Slack thread replies to the existing session via [subscriptions](https://docs.augmentcode.com/cosmos/experts-triggers-subscriptions-integrations.md), not launch triggers. |
| Access | The repositories and intake systems the Expert can read, and where it may push branches, open PRs, publish images, or post updates. Use [managed secrets](https://docs.augmentcode.com/cosmos/config-secrets.md) and least-privilege access. |
| Verification | The approved local or CI workflow, required checks, and a scanner whose results the Expert can retrieve. Define which findings block delivery. |
| Team knowledge | Keep source mappings, build instructions, supported versions, and owners in a repository file or the [virtual filesystem (VFS)](https://docs.augmentcode.com/cosmos/understanding-files.md). Keep workflow rules in the Expert prompt and run-specific evidence separate from shared knowledge. |

> [!NOTE]
>
> Keep material breaking changes, risk acceptance, and merging with human owners. Permission to build or publish an image does not authorize deployment.

## Typical steps in the Expert prompt

Compare the unchanged artifact with the candidate to check whether the fix resolves the reported findings without introducing new ones.

```mermaid theme={null}
flowchart TD
    A[Confirm affected source] --> B[Scan unchanged artifact]
    B --> C[Apply fix, test, and build]
    C --> D[Scan candidate artifact]
    B --> E[Compare baseline and candidate]
    D --> E
    E --> F[Report evidence and next action]
```

1. **Confirm the source.** Map the report to the canonical repository, build recipe, and target platform. Check whether the affected component is a direct or transitive dependency, a bundled tool, or a base-image package. Ask for missing information if the mapping remains unclear.
2. **Capture a baseline before editing.** Record the source revision, artifact, and scan reference. Distinguish a scan of the reported image from a scan of a fresh build of unchanged source. If the baseline is missing, incomplete, or doesn't reproduce the report, investigate rather than claiming a fix.
3. **Choose the smallest supported fix.** Use published advisories and release notes to confirm the fixing version and check compatibility against actual consumers. Escalate material breaking changes instead of silently expanding scope.
4. **Apply the fix, run checks, and build.** Use the repository's package manager and lockfile workflow. Run the required tests and build the intended artifact. If a test image must be published, use a unique tag in an approved non-production registry.
5. **Scan the candidate and compare.** Match findings by advisory and affected package or path against a comparable baseline, not by total counts or a scanner's “new” label. If you make another correction, rebuild and scan the replacement artifact. For example, your policy might require all requested findings to be resolved and no new High or Critical findings to appear.
6. **Report the outcome.** Update the original ticket or thread with the next action. Link the PR if there is one, or share the image's registry reference and digest once the fix is verified. Put the evidence in the PR or, for image-only delivery, in the ticket or thread: version choice, compatibility, check results, links to both scans, and any remaining findings or unavailable checks.

   Call the fix verified only when required checks pass and the scan meets policy. If verification is incomplete or fails, report the blocker, keep any PR in draft, and don't deliver a candidate image as the fix. If no change is needed, report the evidence instead of opening an empty PR.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.