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
PLAT-15858 Update documentation and remove language detection code (#248)
* Normalizes CodeQL tool driver name matching
Ensures that the CodeQL tool driver name is correctly overwritten to 'GitHub CodeQL' regardless of case or surrounding whitespace.
Updates the logic to trim and lowercase the tool driver name before comparing it to "codeql", handling variations in casing and spacing.
Also adds unit tests to verify the fix works for different cases.
* Bump dependency versions
* More updates
* Remove unused github token
* Minor updates to README
---------
Co-authored-by: Colin Wong <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+66-12Lines changed: 66 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,39 @@
1
-
# GitHub Action
1
+
# Secure Code Warrior SARIF Processing Tool
2
2
3
-
This GitHub Action adds Secure Code Warrior contextual application security training material to SARIF files. This training material will be displayed within Code Scanning alerts if the resulting SARIF file is imported using the `github/codeql-action/upload-sarif` Action, and includes links to secure coding exercises and short explainer videos where available.
3
+
## Overview
4
4
5
-
This Action currently supports adding training material based on CWE references (e.g. CWE 89) and common vulnerability phrases (e.g. use-after-free vulnerability) included in static analysis findings.
5
+
This tool processes SARIF (Static Analysis Results Interchange Format) files, typically generated by static code analysis tools like CodeQL, and can be run as a GitHub Action or as a standalone CLI tool.
6
+
It adds Secure Code Warrior contextual application security training material to SARIF files.
7
+
This training material will be displayed within Code Scanning alerts if the resulting SARIF file is imported using the `github/codeql-action/upload-sarif` Action, and includes links to secure coding exercises and short explainer videos where available.
8
+
This tool currently supports adding training material based on CWE references (e.g. CWE 89) and common vulnerability phrases (e.g. use-after-free vulnerability) included in static analysis findings.
6
9
7
-
## Usage
10
+
### Key Features
11
+
12
+
-**Integration of Secure Code Warrior Training Material:**
13
+
14
+
The tool enriches SARIF files by adding **Secure Code Warrior** contextual application security training content. When the resulting SARIF file is imported using the [`github/codeql-action/upload-sarif`](https://github.com/github/codeql-action) GitHub Action, this training material is displayed directly within Code Scanning alerts.
15
+
16
+
The added content includes links to:
17
+
18
+
- Secure coding exercises
19
+
- Short explainer videos (where available)
20
+
21
+
Currently, the tool supports adding training materials based on:
22
+
23
+
- CWE references (e.g., CWE-89)
24
+
- Common vulnerability phrases (e.g., use-after-free vulnerability)
25
+
26
+
These are extracted from static analysis findings to provide relevant, actionable learning resources alongside detected vulnerabilities.
27
+
28
+
-**Flexible File Input:**
29
+
Supports glob and wildcard patterns for input files, allowing batch processing of SARIF files in a directory, recursively, or by matching specific patterns.
30
+
31
+
-**Robust Output Handling:**
32
+
Outputs processed SARIF results to specified filenames, with support for file overwriting and verification of output file patterns.
33
+
34
+
---
35
+
36
+
## Usage - GitHub Actions
8
37
9
38
### Individual SARIF file
10
39
@@ -34,7 +63,6 @@ This Action currently supports adding training material based on CWE references
34
63
with:
35
64
inputSarifFile: sarif/findings.sarif
36
65
outputSarifFile: sarif/findings.processed.sarif
37
-
githubToken: ${{ secrets.GITHUB_TOKEN }}
38
66
39
67
- name: Import Results
40
68
uses: github/codeql-action/upload-sarif@v3
@@ -60,7 +88,6 @@ This Action currently supports adding training material based on CWE references
60
88
with:
61
89
inputSarifFile: ./sarifs/*.json
62
90
outputSarifFile: ./processed-sarifs
63
-
githubToken: ${{ secrets.GITHUB_TOKEN }}
64
91
65
92
- name: Import Results
66
93
uses: github/codeql-action/upload-sarif@v3
@@ -86,24 +113,51 @@ This Action currently supports adding training material based on CWE references
86
113
with:
87
114
inputSarifFile: ./sarifs
88
115
outputSarifFile: ./processed-sarifs
89
-
githubToken: ${{ secrets.GITHUB_TOKEN }}
90
116
91
117
- name: Import Results
92
118
uses: github/codeql-action/upload-sarif@v3
93
119
with:
94
120
sarif_file: ./processed-sarifs
95
121
```
96
122
97
-
## Inputs
123
+
### Inputs
98
124
99
-
### `inputSarifFile`
125
+
####`inputSarifFile`
100
126
101
127
The SARIF file(s) to add Secure Code Warrior contextual training material to. This can be a path to a single file (e.g. `./findings.sarif`), a glob path (e.g. `./scans/**/*.sarif`) or a directory (d.g. `./scans`), in which case all `.sarif` files recursively in the specified directory will be processed. **Default value:** `./findings.sarif`
102
128
103
-
### `outputSarifFile`
129
+
#### `outputSarifFile`
104
130
105
131
The output path of the resulting SARIF file(s) with Secure Code Warrior contextual training material appended. If a glob path or a directory was provided as the `inputSarifFile` input then the resulting SARIF files will be output to the `./processed-sarifs` directory, which can then simply be the path provided in the `sarif_file` input of the `github/codeql-action/upload-sarif` action. **Default value:** `./findings.processed.sarif`
106
132
107
-
### `githubToken` (optional)
133
+
## Usage - Command line
134
+
135
+
This GitHub Action can also be run in CLI mode, to enable integration with other CI tools e.g. [Jenkins](https://www.jenkins.io/)
108
136
109
-
Provide `${{ secrets.GITHUB_TOKEN }}` to use the GitHub access token automatically supplied by GitHub Workflows. This enables language-specific training links to be generated (where available) by fetching the repository language from the GitHub API.
137
+
### Syntax
138
+
```bash
139
+
node clilauncher.js <input-pattern> <output-file>
140
+
```
141
+
- input-pattern: Path to the SARIF file(s) you want to process. Supports:
142
+
- Exact file path
143
+
- Wildcard patterns (e.g., *.sarif)
144
+
- Recursive globstars (e.g., **/*.sarif)
145
+
- output-file: File path where the processed SARIF results will be saved.
146
+
147
+
**Important:**
148
+
- Globstar and wildcard patterns should be enclosed in quotes to prevent the shell from expanding them prematurely.
149
+
- If a globstar pattern is used, the default output dir will be `./processed-sarifs`. Otherwise, files will be output to the root directory.
0 commit comments