Skip to content

Commit 386e1b3

Browse files
Merge pull request #18 from Contrast-Security-OSS/TS-39568_telemetry_support
Ts 39568 telemetry support
2 parents a8c7ae7 + 32cb7a3 commit 386e1b3

15 files changed

+1180
-547
lines changed

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
# Contrast Configuration
6060
contrast_host: ${{ vars.CONTRAST_HOST }} # The host name of your Contrast SaaS instance, e.g. 'app.contrastsecurity.com'
6161
contrast_org_id: ${{ vars.CONTRAST_ORG_ID }} # The UUID of your Contrast organization
62-
contrast_app_id: ${{ vars.CONTRAST_APP_ID }} # The UUID that is specific to the application in this repository
62+
contrast_app_id: ${{ vars.CONTRAST_APP_ID }} # The UUID that is specific to the application in this repository.
6363
contrast_authorization_key: ${{ secrets.CONTRAST_AUTHORIZATION_KEY }}
6464
contrast_api_key: ${{ secrets.CONTRAST_API_KEY }}
6565
@@ -154,7 +154,7 @@ jobs:
154154

155155
* Store all sensitive values (API keys, tokens) as GitHub Secrets in your repository or Github organization settings.
156156
* Replace `v1` with the specific version of the SmartFix GitHub Action you intend to use.
157-
* The `contrast_app_id` must correspond to the Contrast Application ID for the code in the repository where this action runs.
157+
* 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.
158158
* The `build_command` configured for `generate_fixes` job must be an appropriate build command for your project and is required for the proper functioning of SmartFix. A `build_command` that runs your project's unit tests would be doubly useful as it would enable SmartFix to attempt to correct any changes that break your project's tests. Please remember to do any additional setup for your `build_command` (such as library installation) in the `generate_fixes` job as a new step preceeding the `Run Contrast AI SmartFix - Generate Fixes Action` step. For details about the libraries that come pre-installed with Github's Ubuntu runner, please visit https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md.
159159
* 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.
160160
* **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.
@@ -169,7 +169,7 @@ For the Early Access release, SmartFix uses a "Bring Your Own LLM" (BYOLLM) mode
169169
* Provide your `anthropic_api_key`.
170170
* Option 2 - AWS Bedrock:
171171
* Set `agent_model` to the appropriate model string (e.g., `bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0`).
172-
* Provide AWS credentials (`aws_access_key_id`, `aws_secret_access_key`, `aws_region_name`).
172+
* In order for the action to an AWS Bedrock LLM, you need to provide AWS credentials. We recommend using [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) to configure your credentials for a job.
173173

174174
* **Experimental:** **Google Gemini Pro (e.g., Gemini 2.5 Pro)**. Preliminary testing shows good results, but it has not been fully tested for this release.
175175
* Set `agent_model` to the appropriate model string (e.g., `gemini/gemini-1.5-pro-latest`).
@@ -253,6 +253,27 @@ The following are key inputs for the GitHub Action. Refer to the `action.yml` in
253253
| `debug_mode` | Enable verbose logging. | No | `false` |
254254
| `skip_qa_review` | Skip the QA review step (not recommended). | No | `false` |
255255
| `skip_writing_security_test` | Skip attempting to write a security test for the fix. | No | `false` |
256+
| `enable_full_telemetry` | Control how much telemetry data is sent back to Contrast. When set to 'true' (default), sends complete log files and build commands. When 'false', sensitive build commands and full logs are omitted. | No | `true` |
257+
258+
## Telemetry
259+
260+
SmartFix collects telemetry data to help improve the service and diagnose issues. This data includes:
261+
262+
* Vulnerability information (IDs and rules)
263+
* Application metadata (programming language, frameworks)
264+
* Configuration settings (sanitized build and formatting commands)
265+
* Result information (PR creation status, files modified)
266+
* Full log output
267+
268+
### Telemetry Configuration
269+
270+
* The telemetry behavior is determined by the `enable_full_telemetry` setting:
271+
* When `enable_full_telemetry: 'true'` (default): Sends complete logs and all configuration data
272+
* When `enable_full_telemetry: 'false'`: Omits both log data and sensitive build commands
273+
274+
### Data Handling
275+
276+
* All telemetry data is handled according to Contrast Security's privacy policies.
256277

257278
## Troubleshooting
258279

@@ -293,4 +314,4 @@ The following are key inputs for the GitHub Action. Refer to the `action.yml` in
293314

294315
---
295316

296-
For further assistance or to provide feedback on the Early Access release, please contact your Contrast Security representative.
317+
For further assistance or to provide feedback on the Early Access release, please contact your Contrast Security representative.

action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ inputs:
120120
description: 'Specifies the task for the action to perform. "generate_fix" (default) runs main.py, "merge" runs merge_handler.py.'
121121
required: false
122122
default: 'generate_fix'
123+
enable_full_telemetry:
124+
description: 'Enable full telemetry, including potentially sensitive data. Defaults to true.'
125+
required: false
126+
default: 'true'
123127

124128
runs:
125129
using: 'composite'
@@ -288,4 +292,6 @@ runs:
288292
# --- Vulnerability Configuration ---
289293
VULNERABILITY_SEVERITIES: ${{ inputs.vulnerability_severities }}
290294
# --- Run Task ---
291-
RUN_TASK: ${{ inputs.run_task }}
295+
RUN_TASK: ${{ inputs.run_task }}
296+
# --- Telemetry Configuration ---
297+
ENABLE_FULL_TELEMETRY: ${{ inputs.enable_full_telemetry }}

contrast-ai-smartfix.yml.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ jobs:
8383
aws_bedrock_runtime_endpoint: ${{ vars.AWS_BEDROCK_RUNTIME_ENDPOINT }}
8484
# --- Agent Configuration ---
8585
agent_model: ${{ vars.AGENT_MODEL || 'bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0' }}
86+
# Other Optional Inputs (see action.yml for defaults and more options)
87+
# 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.
88+
# max_open_prs: 5 # This is the maximum limit for the number of PRs that SmartFix will have open at single time
89+
# enable_full_telemetry: 'false' # Set to false to disable full telemetry
8690

8791
handle_pr_merge:
8892
name: Handle PR Merge

0 commit comments

Comments
 (0)