1- # This workflow uses actions that are not certified by GitHub.
2- # They are provided by a third-party and are governed by
3- # separate terms of service, privacy policy, and support
4- # documentation.
5-
6- # This workflow integrates Brakeman with GitHub's Code Scanning feature
7- # Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
8-
91name : Brakeman Scan
102
113on :
124 push :
135 branches : [ "main" ]
146 pull_request :
15- # The branches below must be a subset of the branches above
167 branches : [ "main" ]
178 schedule :
189 - cron : ' 26 3 * * 0'
@@ -22,37 +13,38 @@ permissions:
2213
2314jobs :
2415 brakeman-scan :
25- permissions :
26- contents : read # for actions/checkout to fetch code
27- security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
28- actions : read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
2916 name : Brakeman Scan
17+ # Option A: stay on latest (24.04) – requires up-to-date setup-ruby
3018 runs-on : ubuntu-latest
19+ # Option B (fallback): force older image if you prefer
20+ # runs-on: ubuntu-22.04
21+
22+ permissions :
23+ contents : read
24+ security-events : write
25+ actions : read
26+
3127 steps :
32- # Checkout the repository to the GitHub Actions runner
33- - name : Checkout
34- uses : actions/checkout@v3
35-
36- # Customize the ruby version depending on your needs
37- - name : Setup Ruby
38- uses : ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
39- with :
40- ruby-version : ' 3.2'
41-
42- - name : Setup Brakeman
43- env :
44- BRAKEMAN_VERSION : ' 4.10' # SARIF support is provided in Brakeman version 4.10+
45- run : |
46- gem install brakeman --version $BRAKEMAN_VERSION
47-
48- # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
49- - name : Scan
50- continue-on-error : true
51- run : |
52- brakeman -f sarif -o output.sarif.json .
53-
54- # Upload the SARIF file generated in the previous step
55- - name : Upload SARIF
56- uses : github/codeql-action/upload-sarif@v2
57- with :
58- sarif_file : output.sarif.json
28+ - name : Checkout
29+ uses : actions/checkout@v4
30+
31+ - name : Setup Ruby
32+ # Use the rolling v1 tag so you get fixes for new runner images
33+ uses : ruby/setup-ruby@v1
34+ with :
35+ ruby-version : ' 3.2' # or your exact patch, e.g. '3.2.2'
36+ # bundler-cache not needed since we install brakeman directly
37+
38+ - name : Setup Brakeman
39+ run : |
40+ gem install brakeman
41+
42+ - name : Scan (SARIF)
43+ continue-on-error : true
44+ run : |
45+ brakeman -f sarif -o output.sarif.json .
46+
47+ - name : Upload SARIF
48+ uses : github/codeql-action/upload-sarif@v3
49+ with :
50+ sarif_file : output.sarif.json
0 commit comments