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

# CVE Auto-Fix

> Set up a GitHub repository, review tested dependency upgrades, and confirm which CVEs were fixed.

CVE Auto-Fix opens GitHub pull requests for vulnerable dependencies that your code can reach. You choose the target branch and the tests CodeAnt must run. CodeAnt prepares and verifies the upgrade. Your team reviews and merges the pull request (PR).

## Enable Auto-Fix for your organization

1. Sign in to CodeAnt as an **organization admin** and select your GitHub organization. The CodeAnt GitHub App needs access to each repository you want to enable. See [Connect GitHub](https://docs.codeant.ai/setup/github.md).
2. Open **Settings → Code Analysis → CVE Auto-Fix**. Review **Free pull requests** and **AI credits**, then turn on **Open fix pull requests**. The **Repositories** table appears.
3. Choose a repository that uses **npm** or **pip** and has tests that run on Linux ARM64. Auto-Fix uses findings from Software Composition Analysis (SCA). Check that SCA is enabled for the repository under **Settings → Code Analysis → Analysis Configuration**. See [Configure repository scans](https://docs.codeant.ai/repositories/analysis_configuration.md).

The first **20 reviewed PRs** are free across the organization. After that, CodeAnt charges **\$5 in AI credits for each reachable CVE fixed in a package**, counted once per repository. Two paths to the same affected package count once. Fixing the same CVE in two different packages costs \$10. A draft PR shows the estimate. CodeAnt verifies the final amount and charges when the PR leaves draft.

## Set up and validate a repository

1. In **Repositories**, open the repository. CodeAnt reads its manifests and CI configuration. Select **Use detected setup** to fill in the suggested values, or enter them yourself.

2. Confirm the **Target branch**, **Package manager**, and Node.js or Python version. Set **Project folder** to the directory containing the dependency files. Use `.` for the repository root.

3. Under **Commands**, enter the **Install command**, **Test command**, and **Test report** path. Add a **Build command** if the project needs one. Commands run in the project folder. The report path is relative to the repository root.

   For example, if a pip project lives in `api/` and uses pytest, set **Project folder** to `api`, **Install command** to `pip install -r requirements.txt`, **Test command** to `pytest --junitxml=junit.xml`, and **Test report** to `api/junit.xml`. The install command must install the test dependencies too.

4. If pip needs a private GitHub dependency and your setup shows **Private Git dependencies**, select **Add variable**. Enter the variable name referenced in your pip requirement and a GitHub token with read access to that dependency. You can also assign fix PRs to a GitHub username under **PR owner**, or list draft PR checks and their reporting GitHub apps under **Repository CI checks**.

5. Select **Save**, then **Run validation**. CodeAnt installs dependencies, runs the optional build and tests on the latest target-branch commit, and reads the JUnit XML report. Validation needs at least one passing test and no failures, errors, or skipped tests.

6. When the repository shows **Ready to turn on**, select **Turn on auto-fix**. Check that the repository now shows **On**. Repeat for each repository you want to enable.

For several repositories, select their rows and use **Detect setup**, then **Save & validate** after reviewing the suggestions. Open any row marked **Needs input** to complete its setup. Select **Turn on** for each repository that passes.

## What CodeAnt does automatically

1. **Selects a fix.** CodeAnt checks SCA findings on the target branch for confirmed reachable vulnerabilities in supported registry packages. It looks for a compatible patched version. For a transitive dependency, it can update the parent dependency when needed. One PR can address several CVEs.
2. **Prepares and tests the change.** CodeAnt updates the dependency files, checks the proposed change in a private review, and opens a draft PR. It tests the proposed merge against the target branch and checks the installed packages against the advisories. The PR records what changed and which tests passed.
3. **Requests review.** When verification succeeds for the current commits, CodeAnt updates the PR with the verified fixes and final price and marks it ready for review. If an upgrade needs an owner decision or only fixes part of the problem, the finding explains what still needs attention.

## Review, merge, and confirm the fix

1. From repository setup, select **View progress**, or open **Code Security → CVE Auto-Fix**. Select a finding to see its **Next step**, verification results, and related PR.
2. When the finding shows **Open for review**, select **Open pull request**. In GitHub, review the dependency changes, the CVEs addressed, and the test evidence. Follow your repository's usual approval and required CI checks, then merge when satisfied.
3. Return to **CVE Auto-Fix** to confirm the result. After the merge, CodeAnt checks the installed dependencies on the target branch. The finding stays open until CodeAnt confirms the vulnerable version is gone.

## When a fix needs your attention

| What you see | What to do |
| - | - |
| Repository setup is **Blocked** | Open the repository and read the validation failure. Check the runtime, install command, and any private dependency credentials. If the tests ran, check that the report path matches the file they wrote and that all tests passed. Save any corrections and run validation again. |
| The repository is **On**, but there is no PR | Check the target branch and project folder, then open the finding in **CVE Auto-Fix**. If the branch has no current SCA results, start a scan from **Repositories**. If reachability is inconclusive, open the vulnerability in SCA and select **Verify with agent**. See [reachability verdicts](https://docs.codeant.ai/scan_center/code_security/sca.md#reachability-analysis). |
| Verification is out of date, or a fix has stopped | Open the finding and read **Next step**. Select **Recheck now** if the PR or target branch changed, or use the retry action shown for that finding. If the fix needs a major upgrade or the draft leaves a CVE unresolved, review the remaining work and decide how to migrate. |
| A teammate pushed commits to the fix PR | CodeAnt stops editing the PR. Finish it by hand, or close it and use the retry action when offered. |
| New fixes are paused for lack of credits | In **Settings → Code Analysis → CVE Auto-Fix**, select **Add credits** to fund new fixes. |

To stop new fix PRs for one repository, open its setup and select **Pause**. Existing PRs stay open. Select **Resume** when you're ready, or validate again if prompted. Saving changes to an active repository's setup turns Auto-Fix off for that repository. Validate the new setup and turn it on again.


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