> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/sast-and-sca/prezero/autofix.md).

# AutoFix

![](/files/mlZo7QhbBaWAQlpvEVi9)note

This capability is not enabled by default. Please contact Customer Success if you need assistance.

Qwiet AI AutoFix uses large language models (LLMs) to generate potential code fix suggestions for findings produced by Qwiet AI by Harness analyses. In addition to code changes, AutoFix also provides steps to address the vulnerability findings.

AutoFix suggestions are provided in context of a particular analysis and the existing application source code. To generate the fix, the LLM uses data available in the Code Property Graph (CPG) generated during the application analysis, including relevant source code snippets captured only when this capability is enabled. Qwiet AI AutoFix LLMs are deployed in Qwiet AI's virtual private cloud, and none of the data is shared with any third party.

![](/files/mlZo7QhbBaWAQlpvEVi9)note

Qwiet AI does NOT do any model training with customer data

AutoFix suggestions are generated automatically while the application is being analyzed in the cloud. This is an asynchronous process, and will not slow down the reporting of findings. Suggestions might take several seconds to be available for a particular finding. At the moment, AutoFix suggestions are generated for the top ten SAST findings for each application, sorted by severity in descending order (critical, high, medium, low).

## Limitations <a href="#limitations" id="limitations"></a>

Users must always consider the limitations of AI and review and edit the suggestion or pull request to ensure that the resulting code and application are correct, secure, performant, compliant, etc.

Qwiet AI AutoFix capability has the following known limitations:

* The system primarily uses English data. If code and comments are written in other languages, the quality of the suggestions might be diminished
* The AutoFix suggestion might contain code that is not syntactically correct. Linters and proper test coverage should help mitigate this issue
* AutoFix suggestions might change the semantics of the application. Good test coverage should help mitigate this issue
* Some AutoFix suggestions might not fix or resolve the vulnerability finding, and in some cases it might introduce additional issues. Review suggestions carefully

## Viewing and using AutoFix suggestions <a href="#viewing-and-using-autofix-suggestions" id="viewing-and-using-autofix-suggestions"></a>

The main goal of Qwiet AI AutoFix suggestions is to help software developers and security practitioners fix vulnerability findings faster.

AutoFix suggestions generally include the updated code and steps to address the vulnerability finding. The user can copy the code and paste it in an IDE or code editor, verify that the code works as intended, and then re-analyze the application. The user can also ignore the code and use the steps to address the finding to write their own code, and then re-analyze the application. A combination of both approaches could also work well.

To view an AutoFix suggestion, click on a finding in the Vulnerabilities tab in the application details page, and then click on the **AutoFix** tab.

![Finding Details AutoFix panel](/files/4bTZN9p4rpIjeLKek2WV)

To help streamline the amount of information displayed, you can toggle on **Qwiet the Noise**, which filters for only **critical** and **high** severity vulnerabilities. You can also enable the **AutoFix Available** filter, which lists only findings that have an AutoFix suggestion available.

Please provide feedback by scrolling down to the bottom of the AutoFix suggestion panel, and clicking the thumbs up/down button. Optionally, select a reason for the thumbs up/down, type in additional feedback, and click the *Submit* button.

![Finding Details AutoFix rating form](/files/7c9vbJQMmHVJ5RDyPU23)

## Agentic Workflow <a href="#agentic-workflow" id="agentic-workflow"></a>

By default, the AutoFix capability is powered by multiple AI agents. These agents collaborate with each other to provide a final result for the user, as well as individual results that could help in the resolution of a finding.

The final result appears at the top of the AutoFix tab, and it's usually provided by **Catherine AppSec Team Lead** or **Nova Refactoring Engineer** (for cases where a code refactoring was necessary).

To view additional results, scroll down and click on **View results from other agents >>**.

![Agentic Workflow](/files/lHmd0g4UdoPYV1vH12ST)

The following agents are currently available:

* **Scout Threat Analyst**: Cybersecurity expert. Identifies potential attack vectors in vulnerable code and generates attack payloads
* **Toby Test Engineer**: Cybersecurity expert and Quality Assurance Engineer. Generates test cases based on attack payloads provided by Scout
* **Clara AppSec Engineer**: Application Security Engineer. Analyzes mitigation notes and test cases provided by Toby and fixes the code accordingly
* **Evan Security Engineer**: Security expert and Software Engineer. Examines the vulnerable code and provides notes suggesting a more effective and improved approach that mitigates the vulnerability
* **Hal Dependency Inspector**: Software and Security Engineer. Assesses the reliability of the dependencies/imports suggested in the fixed code
* **Nova Refactoring Engineer**: Refactoring Engineer. Identifies and rectifies dependency issues, refactoring the code as necessary
* **Catherine AppSec Team Lead**: AppSec team lead. Reviews results from other agents in the team and fixes any additional issues, ensuring that every piece of code maintains high standards of efficiency and security

## Enabling or disabling AutoFix suggestions <a href="#enabling-or-disabling-autofix-suggestions" id="enabling-or-disabling-autofix-suggestions"></a>

AutoFix can be configured at the organization level in the [Organization Settings](https://app.shiftleft.io/organization/settings) page. Use the **Enable AutoFix** toggle to turn the feature on or off. When enabled, AutoFix will work for all applications in the organization unless it's explicitly disabled, since the default application setting for AutoFix is **Inherit** (see below).

![Organization Settings](/files/Ck37ygDSbBhSvIbRuYBY)

Autofix can also be configured at the application level, in each application's Settings page. The AutoFix section has three options: **Inherit** (which is the default), **Enable**, and **Disable**. When the **Inherit** option is selected, AutoFix will be enabled or disabled for this application based on the organization settings. When **Enable** or **Disable** are selected, Autofix will be enabled or disabled irrespective of the organization settings.

![Application Settings](/files/o65R6oyXoJzqXiJ2aA2w)

## AutoFix Pull Requests <a href="#autofix-pull-requests" id="autofix-pull-requests"></a>

![](/files/mlZo7QhbBaWAQlpvEVi9)note

AutoFix pull requests work with **GitHub**, **Azure DevOps**, **BitBucket** and **Harness** repositories. Additional providers will be available at a later time.

AutoFix can manually or automatically submit a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) once an application analysis is completed and AutoFix suggestions are available. Note that if the pull request remains open, subsequent analyses will amend the existing pull request, instead of creating a new one. This behavior can be changed by choosing **Create Standalone Pull Request** when creating a Pull Request.

![Application Findings - Create Standalone Pull Request](/files/TbskpJcakRYeAhYhEYox)

Once a pull request is created by AutoFix, it can be treated as a normal pull request (e.g. reviewed, approved, receive additional commits).

To enable this functionality, you will need to provide following credentials:

### Github Repositories <a href="#github-repositories" id="github-repositories"></a>

1. Owner (GitHub organization)
2. [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)

The following scopes are required for **Tokens (classic)**:

* `repo`

The following scopes are required for **Fine-grained tokens**:

* `Read and Write access to pull requests`
* `Read access to metadata` (automatically added by GitHub)

![](/files/mlZo7QhbBaWAQlpvEVi9)note

Please note that if your GitHub organization has SAML SSO enabled (e.g. GitHub Enterprise Managed Users), you must [authorize the PAT](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on) after its creation before it can access repositories in the organization.

### Azure DevOps Repos <a href="#azure-devops-repos" id="azure-devops-repos"></a>

1. Owner (Azure DevOps organization)
2. [Personal Access Token](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops\&tabs=Windows#create-a-pat)

![](/files/mlZo7QhbBaWAQlpvEVi9)note

Azure DevOps PAT should have minimum **Code: Read & Write** scopes.

### BitBucket Repositories <a href="#bitbucket-repositories" id="bitbucket-repositories"></a>

1. Owner (BitBucket workspace)
2. Access Token

![](/files/mlZo7QhbBaWAQlpvEVi9)note

* Access token can be created at [repository](https://support.atlassian.com/bitbucket-cloud/docs/create-a-repository-access-token/) level, [project](https://support.atlassian.com/bitbucket-cloud/docs/create-a-project-access-token/) level or [workspace](https://support.atlassian.com/bitbucket-cloud/docs/create-a-workspace-access-token/) level.
* The name of the token set (i.e. **Harness SAST and SCA**) will be used as the author name and shown in Commit history / Pull request updates.
* Token must have **pullrequest:write** scope.

### Harness Code Repos <a href="#harness-code-repos" id="harness-code-repos"></a>

1. Owner (Repo Owner's Account ID)
2. [Personal Access Token](/harness-ai/use-harness-platform/automation/api/api-quickstart.md#create-a-harness-api-key-and-token) or [Service Account Token](/harness-ai/use-harness-platform/automation/api/add-and-manage-api-keys.md#create-service-account-api-keys-and-tokens)

![](/files/mlZo7QhbBaWAQlpvEVi9)note

The Harness Service Account Token should have minimum **Users:view** and **Repository:view, review, push** permissions. The built-in **Code Contributor** role has all these permissions.

### Configuring PAT Credentials <a href="#configuring-pat-credentials" id="configuring-pat-credentials"></a>

These credentials can be provided at the user, application, team, and organization levels. AutoFix will look for the credentials in the following order:

1. User
2. Application
3. Team
4. Organization

For example: if the credentials are provided in an Application's settings, in the application's Team settings, and in Organization's Settings, but not provided for the organization user, it will use the PAT provided in the Application's settings and ignore any Team and Organization credentials.

Note that only the following roles or custom roles with the `autofix_pat:read` scope can read a PAT and use it to create an AutoFix Pull Request:

* Organization
  * Owner
  * Super admin
  * Power user
* Team
  * Team admin
  * Team manager
  * Team developer

See the [User permissions](/sast-and-sca/prezero/users/permissions.md) page for additional details about permissions.

### Organization-level PAT configuration <a href="#organization-level-pat-configuration" id="organization-level-pat-configuration"></a>

For the Organization, provide PAT credentials in the **Enable AutoFix** section of the [Organization Settings](https://app.shiftleft.io/organization/settings) page.

You can choose whether the pull request should be created automatically (default) or manually with the **Create Pull Request** button, when reviewing findings that have an AutoFix suggestion available. Go to [Viewing and using AutoFix suggestions](#viewing-and-using-autofix-suggestions) to see an example.

![Organization Settings - AutoFix Pull Requests](/files/xxPT6ZRwgK8tw1GP5BQ0)

### Team-level PAT configuration <a href="#team-level-pat-configuration" id="team-level-pat-configuration"></a>

For teams, provide the PAT credentials in the [Manage Teams](https://app.shiftleft.io/organization/teams) page by clicking on the Pull Requests button.

![Manage Teams page - AutoFix Pull Requests settings](/files/WXmcSiD33Q4Bzw3HAtoi)

### Application-level PAT configuration <a href="#application-level-pat-configuration" id="application-level-pat-configuration"></a>

For apps, provide the GitHub credentials in the **Application Settings** page, under the **AutoFix** section.

![Application Settings page - AutoFix settings](/files/eoVthLxVC3kVTwF1a5QT)

### User-level PAT configuration <a href="#user-level-pat-configuration" id="user-level-pat-configuration"></a>

Users can provide their PAT credentials in the **Organization Overview** page, under the **User Information** section.

![Organization Overview page - User Information PAT](/files/5xpfkNfQeywcT1cb2wYm)

## Supported languages <a href="#supported-languages" id="supported-languages"></a>

Qwiet AI AutoFix is available for applications written in the following programming languages:

* Apex
* C#
* Go
* Java
* JavaScript
* PHP
* PL/SQL
* Python
* Terraform
* TypeScript

Coming soon:

* C/C++
* Groovy
* Ruby
* Swift

![](/files/mlZo7QhbBaWAQlpvEVi9)note

In most cases, only the latest "src" CPG frontend is supported (e.g. `--jssrc` instead of `--js`, `--javasrc` instead of `--java`, `--pythonsrc` instead of `--python`). This is the default behavior when language detection is in use.

For further assistance or inquiries, please contact your Customer Success representative.
