Skip to content

Commit 8059069

Browse files
- PR feedback
1 parent 2c4f7e8 commit 8059069

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

docs/claude_code.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ When the `@claude` handle is mentioned in the title of a SmartFix-created GitHub
2222

2323
* **Contrast Assess:** You need an active Contrast Assess deployment identifying vulnerabilities in your application.
2424
* **GitHub:** Your project must be hosted on GitHub and use GitHub Actions. In the GitHub repository's Settings, enable the Actions > General > Workflow Permissions checkbox for "Allow GitHub Actions to create and approve pull requests".
25+
* **Claude Code Requirements:**
26+
* GitHub repository with **Issues** and **GitHub Copilot** enabled
27+
* GitHub Personal Access Token (PAT) with:
28+
* `meta` (read permissions)
29+
* `actions` (read permissions)
30+
* `pulls` (read-write permissions)
31+
* `issues` (read-write permissions)
32+
* **Suggestion:** Set up a GitHub service account and use that to make the PAT for more explicit tracking of SmartFix's work in GitHub.
2533
* **Contrast API Credentials:** You will need your Contrast Host, Organization ID, Application ID, Authorization Key, and API Key.
26-
* **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).
2734
* **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).
2835

2936
Set the gathered values as secrets and variables for the GitHub repository at Settings tab > Secrets and Variables in the sidebar > Actions.
@@ -54,10 +61,6 @@ on:
5461
- cron: '0 0 * * *' # Runs daily at midnight UTC, adjust as needed
5562
workflow_dispatch: # Allows manual triggering
5663
57-
permissions:
58-
contents: write
59-
pull-requests: write
60-
6164
jobs:
6265
generate_fixes:
6366
name: Generate Fixes
@@ -82,18 +85,17 @@ jobs:
8285
contrast_api_key: ${{ secrets.CONTRAST_API_KEY }}
8386
8487
# GitHub Configuration
85-
github_token: ${{ secrets.PAT_TOKEN }} # Necessary for creating Issues and mentioning Claude Code (@claude). 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)
88+
github_token: ${{ secrets.PAT_TOKEN }} # Necessary for creating Issues and mentioning Claude Code (@claude). This token should have read permission for metadata, read permissions on actions 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)
8689
base_branch: '${{ github.event.repository.default_branch }}' # This will default to your repo default branch (other common base branches are 'main', 'master' or 'develop')
8790
coding_agent: 'CLAUDE_CODE' # Specify the use of Claude Code instead of the default SmartFix internal coding agent
8891
8992
# Other Optional Inputs (see action.yml for defaults and more options)
90-
# 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.
9193
# max_open_prs: 5 # This is the maximum limit for the number of PRs that SmartFix will have open at single time
9294
9395
handle_pr_merge:
9496
name: Handle PR Merge
9597
runs-on: ubuntu-latest
96-
if: github.event.pull_request.merged == true && contains(join(github.event.pull_request.labels.*.name), 'contrast-vuln-id:VULN-')
98+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'claude/issue-')
9799
steps:
98100
- name: Checkout repository
99101
uses: actions/checkout@v4
@@ -105,7 +107,7 @@ jobs:
105107
with:
106108
run_task: merge
107109
# --- GitHub Token ---
108-
github_token: ${{ secrets.GITHUB_TOKEN }}
110+
github_token: ${{ secrets.PAT_TOKEN }}
109111
# --- Contrast API Credentials ---
110112
contrast_host: ${{ vars.CONTRAST_HOST }}
111113
contrast_org_id: ${{ vars.CONTRAST_ORG_ID }}
@@ -118,7 +120,7 @@ jobs:
118120
handle_pr_closed:
119121
name: Handle PR Close
120122
runs-on: ubuntu-latest
121-
if: github.event.pull_request.merged == false && contains(join(github.event.pull_request.labels.*.name), 'contrast-vuln-id:VULN-')
123+
if: github.event.pull_request.merged == false && contains(github.event.pull_request.head.ref, 'claude/issue-')
122124
steps:
123125
- name: Checkout repository
124126
uses: actions/checkout@v4
@@ -130,7 +132,7 @@ jobs:
130132
with:
131133
run_task: closed
132134
# --- GitHub Token ---
133-
github_token: ${{ secrets.GITHUB_TOKEN }}
135+
github_token: ${{ secrets.PAT_TOKEN }}
134136
# --- Contrast API Credentials ---
135137
contrast_host: ${{ vars.CONTRAST_HOST }}
136138
contrast_org_id: ${{ vars.CONTRAST_ORG_ID }}
@@ -146,7 +148,7 @@ jobs:
146148
* Store all sensitive values (API keys, tokens) as GitHub Secrets in your repository or Github organization settings.
147149
* Replace `v1` with the specific version of the SmartFix GitHub Action you intend to use.
148150
* The `contrast_app_id` must correspond to the Contrast Application ID for the code in the repository where this action runs. To find the app ID, visit the application page in the Contrast web UI, then use the last UUID in the URL (immediately after `/applications/`) as the app ID value.
149-
* Set the `coding_agent` value to `CLAUDE_CODE` to force the SmartFix GitHub Action to use the GitHub Copilot coding agent.
151+
* Set the `coding_agent` value to `CLAUDE_CODE` to force the SmartFix GitHub Action to use the Claude Code coding agent.
150152

151153
### Supported Languages
152154

@@ -234,7 +236,7 @@ SmartFix collects telemetry data to help improve the service and diagnose issues
234236
* Ensure the that the repository / organization has GitHub Issues enabled and that the Claude Code GitHub App has been installed on the repository
235237
* Check the GitHub Action logs for specific error messages from the Claude Code agent.
236238
* **PR Creation Failures:**
237-
* Ensure the `PAT_token` has the necessary permissions to create and read Issues and PRs in the repository.
239+
* Ensure the `PAT_token` has the necessary permissions to create and read Actions, Issues and PRs in the repository.
238240
* Check for branch protection rules that might prevent PR creation.
239241
* **No Fixes Generated:**
240242
* Confirm there are eligible CRITICAL or HIGH severity vulnerabilities in Contrast Assess for the configured `contrast_app_id`. SmartFix only attempts to fix vulnerabilities that are in the REPORTED state.

docs/github_copilot.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ When assigned to a SmartFix-created GitHub Issue describing a Contrast-discovere
2828
* `meta` (read permissions)
2929
* `pulls` (read-write permissions)
3030
* `issues` (read-write permissions)
31-
* **Suggestion:** Setup a GitHub service account and use that to make the PAT for more explicit tracking of SmartFix's work in GitHub.
31+
* **Suggestion:** Set up a GitHub service account and use that to make the PAT for more explicit tracking of SmartFix's work in GitHub.
3232
* **Contrast API Credentials:** You will need your Contrast Host, Organization ID, Application ID, Authorization Key, and API Key.
3333

3434
Set the gathered values as secrets and variables for the GitHub repository at Settings tab > Secrets and Variables in the sidebar > Actions.
@@ -59,10 +59,6 @@ on:
5959
- cron: '0 0 * * *' # Runs daily at midnight UTC, adjust as needed
6060
workflow_dispatch: # Allows manual triggering
6161
62-
permissions:
63-
contents: write
64-
pull-requests: write
65-
6662
jobs:
6763
generate_fixes:
6864
name: Generate Fixes
@@ -91,17 +87,13 @@ jobs:
9187
base_branch: '${{ github.event.repository.default_branch }}' # This will default to your repo default branch (other common base branches are 'main', 'master' or 'develop')
9288
coding_agent: 'GITHUB_COPILOT' # Specify the use of GitHub Copilot instead of the default SmartFix internal coding agent
9389
94-
# Required Runtime Configuration
95-
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.
96-
9790
# Other Optional Inputs (see action.yml for defaults and more options)
98-
# 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.
9991
# max_open_prs: 5 # This is the maximum limit for the number of PRs that SmartFix will have open at single time
10092
10193
handle_pr_merge:
10294
name: Handle PR Merge
10395
runs-on: ubuntu-latest
104-
if: github.event.pull_request.merged == true && contains(join(github.event.pull_request.labels.*.name), 'contrast-vuln-id:VULN-')
96+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'copilot/fix-')
10597
steps:
10698
- name: Checkout repository
10799
uses: actions/checkout@v4
@@ -113,7 +105,7 @@ jobs:
113105
with:
114106
run_task: merge
115107
# --- GitHub Token ---
116-
github_token: ${{ secrets.GITHUB_TOKEN }}
108+
github_token: ${{ secrets.PAT_TOKEN }}
117109
# --- Contrast API Credentials ---
118110
contrast_host: ${{ vars.CONTRAST_HOST }}
119111
contrast_org_id: ${{ vars.CONTRAST_ORG_ID }}
@@ -126,7 +118,7 @@ jobs:
126118
handle_pr_closed:
127119
name: Handle PR Close
128120
runs-on: ubuntu-latest
129-
if: github.event.pull_request.merged == false && contains(join(github.event.pull_request.labels.*.name), 'contrast-vuln-id:VULN-')
121+
if: github.event.pull_request.merged == false && contains(github.event.pull_request.head.ref, 'copilot/fix-')
130122
steps:
131123
- name: Checkout repository
132124
uses: actions/checkout@v4
@@ -138,7 +130,7 @@ jobs:
138130
with:
139131
run_task: closed
140132
# --- GitHub Token ---
141-
github_token: ${{ secrets.GITHUB_TOKEN }}
133+
github_token: ${{ secrets.PAT_TOKEN }}
142134
# --- Contrast API Credentials ---
143135
contrast_host: ${{ vars.CONTRAST_HOST }}
144136
contrast_org_id: ${{ vars.CONTRAST_ORG_ID }}

docs/smartfix_coding_agent.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
handle_pr_merge:
116116
name: Handle PR Merge
117117
runs-on: ubuntu-latest
118-
if: github.event.pull_request.merged == true && contains(join(github.event.pull_request.labels.*.name), 'contrast-vuln-id:VULN-')
118+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'smartfix/remediation-')
119119
steps:
120120
- name: Checkout repository
121121
uses: actions/checkout@v4
@@ -140,7 +140,7 @@ jobs:
140140
handle_pr_closed:
141141
name: Handle PR Close
142142
runs-on: ubuntu-latest
143-
if: github.event.pull_request.merged == false && contains(join(github.event.pull_request.labels.*.name), 'contrast-vuln-id:VULN-')
143+
if: github.event.pull_request.merged == false && contains(github.event.pull_request.head.ref, 'smartfix/remediation-')
144144
steps:
145145
- name: Checkout repository
146146
uses: actions/checkout@v4

0 commit comments

Comments
 (0)