You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+70-7Lines changed: 70 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,9 +24,26 @@ Welcome to Contrast AI SmartFix\! SmartFix is an AI-powered agent that automatic
24
24
***GitHub Token Permissions:** The GitHub token must have `contents: write` and `pull-requests: write` permissions. These permissions must be explicitly set in your workflow file. Note, SmartFix uses the internal GitHub token for Actions; you do not need to create a Personal Access Token (PAT).
25
25
***LLM Access:** Ensure that you have access to one of our recommended LLMs for use with SmartFix. If using an AWS Bedrock model, please see Amazon's User Guide on [model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html).
26
26
27
+
### Coding Agent
28
+
29
+
SmartFix supports two distinct coding agents for vulnerability remediation:
30
+
31
+
***SmartFix Agent (Recommended):** Uses Contrast vulnerability data with a team of agentic AIs to analyze, fix, and validate vulnerability remediations. This agent creates a complete fix, ensures your project builds successfully, and verifies that existing tests continue to pass. Requires API keys for your preferred LLM provider.
32
+
33
+
***GitHub Copilot Agent (Beta):** Leverages GitHub Copilot for vulnerability fixes through GitHub Issues. SmartFix creates a detailed GitHub Issue with vulnerability information and assigns it to GitHub Copilot for resolution. Copilot then attempts the fix and creates a Pull Request.
34
+
35
+
**GitHub Copilot Requirements:**
36
+
* GitHub repository with **Issues** and **GitHub Copilot** enabled
37
+
* GitHub Personal Access Token (PAT) with:
38
+
*`meta` (read permissions)
39
+
*`pulls` (read-write permissions)
40
+
*`issues` (read-write permissions)
41
+
27
42
### Installation and Configuration
28
43
29
-
SmartFix is configured as a GitHub Action. Add a workflow file (e.g., `.github/workflows/smartfix.yml`) to your repository following the below example. A full workflow example is also available at [https://github.com/Contrast-Security-OSS/contrast-ai-smartfix-action/blob/main/contrast-ai-smartfix.yml.template](https://github.com/Contrast-Security-OSS/contrast-ai-smartfix-action/blob/main/contrast-ai-smartfix.yml.template):
44
+
SmartFix is configured as a GitHub Action. Add a workflow file (e.g., `.github/workflows/smartfix.yml`) to your repository following the below example. A full workflow example is also available at [https://github.com/Contrast-Security-OSS/contrast-ai-smartfix-action/blob/main/contrast-ai-smartfix.yml.template](https://github.com/Contrast-Security-OSS/contrast-ai-smartfix-action/blob/main/contrast-ai-smartfix.yml.template).
45
+
46
+
The following is sample workflow file for using the SmartFix Coding Agent. (An example variation for the GitHub Coding Agent is next, below):
* The optional `formatting_command` will be run after SmartFix makes code changes to resolve the vulnerability and prior to any subsequent `build_command` invocations. We recommend supplying a `formatting_command` to fix code style issues in your project as it is an easy way to correct a common class of build-breaking problems.
162
179
***Suggestion:** Setup an API-only service user named “Contrast AI SmartFix” in your Organization Settings in your Contrast SaaS instance. At a minimum, it should have the “View Organization” permission and “Edit Application” permission for this application. This service user’s `contrast_authorization_key` value and the Organization’s `contrast_api_key` value should be used in the workflow.
163
180
164
-
### Supported LLMs (Bring Your Own LLM \- BYOLLM)
181
+
### Installation and Configuration for GitHub Copilot Coding Agent
182
+
183
+
This is an example variation of the workflow file for use with the GitHub Copilot Coding Agent:
184
+
```
185
+
# The beginning of the workflow file is the same as the previous example.
186
+
187
+
# Use a variation of this 'generate_fixes' job in order to run with the GitHub Copilot Coding Agent
github_token: ${{ secrets.PAT_TOKEN }} # Necessary for creating Issues and assigning to Copilot. This token should have read permission for metadata and read-write permission for issues and pulls. A best practice is to have an GitHub Organization service account create the PAT (an Organization admin may need to approve it)
212
+
base_branch: '${{ github.event.repository.default_branch }}' # This will default to your repo default branch (other common base branches are 'main', 'master' or 'develop')
213
+
coding_agent: 'GITHUB_COPILOT' # Specify the use of GitHub Copilot instead of the default SmartFix internal coding agent
214
+
215
+
# Required Runtime Configuration
216
+
build_command: 'mvn clean install' # Or the build command appropriate for your project. SmartFix will use this command to ensure that its changes work correctly with your project.
217
+
218
+
# Other Optional Inputs (see action.yml for defaults and more options)
219
+
# formatting_command: 'mvn spotless:apply' # Or the command appropriate for your project to correct the formatting of SmartFix's changes. This ensures that SmartFix follows your coding standards.
220
+
# max_open_prs: 5 # This is the maximum limit for the number of PRs that SmartFix will have open at single time
221
+
222
+
# The Closed and Merge Handler jobs remain the same as the previous example as well.
223
+
```
224
+
225
+
### Supported LLMs (Bring Your Own LLM \- BYOLLM) for the SmartFix Coding Agent
165
226
166
-
For the Early Access release, SmartFix uses a "Bring Your Own LLM" (BYOLLM) model. You provide the credentials for your preferred LLM provider.
227
+
SmartFix uses a "Bring Your Own LLM" (BYOLLM) model. You provide the credentials for your preferred LLM provider.
167
228
168
229
***Recommended:****Anthropic Claude Sonnet (e.g., Claude 3.7 Sonnet via AWS Bedrock or direct Anthropic API)**. This model has been extensively tested.
169
230
* Option 1 - Direct Anthropic API:
@@ -180,7 +241,7 @@ For the Early Access release, SmartFix uses a "Bring Your Own LLM" (BYOLLM) mode
180
241
181
242
Refer to the `action.yml` file within the SmartFix GitHub Action repository and LiteLLM documentation for specific `agent_model` strings and required credentials for other models/providers. The LiteLLM documentation can be found at https://docs.litellm.ai/docs/providers/.
182
243
183
-
### Agent Model values
244
+
### Agent Model Config Values
184
245
185
246
Here are several recommended `agent_model` values:
186
247
@@ -190,7 +251,8 @@ Here are several recommended `agent_model` values:
190
251
191
252
### Supported Languages
192
253
193
-
***Java, .NET, Go, Python, Node:** Java applications have received the most testing so far, but we have also had good results for .NET, Go, Python, and Node projects.
254
+
***Java, Python:** SmartFix regularly produces good fixes for a variety Java and Python testing projects (using a variety of project platforms such, as Maven, Gradle, Django, Flask, and WSGI). SmartFix officially supports Java and Python.
255
+
***.NET, Go, Node:** Java and Python applications have received the most testing so far, but we have also had good results for .NET, Go, and Node projects.
194
256
***Other Languages:** While it might work for other languages (such as Ruby, and PHP), comprehensive testing is in progress. Use with caution for non-Java projects.
195
257
196
258
### Supported GitHub Runners
@@ -239,6 +301,7 @@ SmartFix focuses on remediating:
239
301
240
302
## Key Features
241
303
304
+
***Support for Multiple Coding Agents**: Choose to use either the internal SmartFix coding agent or GitHub Copilot to remediate your project's vulnerabilities
242
305
***Bring Your Own LLM (BYOLLM):** Flexibility to use your preferred LLM provider and model.
243
306
***Configurable PR Throttling:** Control the volume of automated PRs using `max_open_prs`.
244
307
***Build Command Integration:** You must provide a `build_command` to allow the agent to ensure changes can build. Ideally, this command will run the tests as well so the agent can ensure it doesn't break existing tests.
0 commit comments