Skip to content

Commit 45668ac

Browse files
authored
feat: replace audit-app and bundler-audit with osv-detector (#351)
1 parent 2c739b1 commit 45668ac

File tree

10 files changed

+38
-37
lines changed

10 files changed

+38
-37
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check dependencies for known security vulnerabilities
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
check-dependencies:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Check dependencies for security vulnerabilities
14+
uses: g-rath/check-with-osv-detector@main

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ jobs:
106106
with:
107107
persist-credentials: false
108108

109+
# this ensures that osv-detector is available for running bin/ci-run
110+
- name: Check dependencies for security vulnerabilities (and setup osv-detector)
111+
uses: g-rath/check-with-osv-detector@main
112+
109113
- name: Install NodeJS
110114
uses: actions/setup-node@v3
111115
with:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Where possible we stick to Rails defaults.
5050
a decision about whether ActiveStorage files must be behind authentication
5151
or not. The default Rails behaviour here can be a security gotcha.
5252
- Security
53+
- Configure [`osv-detector`](https://github.com/G-Rath/osv-detector) to run in
54+
CI
5355
- Install and configure [brakeman](https://github.com/presidentbeef/brakeman)
54-
- Install and configure
55-
[bundler-audit](https://github.com/rubysec/bundler-audit)
5656
- Create `.well-known/security.txt`
5757
- Add a well documented
5858
[Content Security Policy initializer](./variants/backend-base/config/initializers/content_security_policy.rb)

template.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met
9595

9696
copy_file "variants/backend-base/Dockerfile", "Dockerfile"
9797
copy_file "variants/backend-base/docker-compose.yml", "docker-compose.yml"
98+
copy_file "variants/backend-base/.osv-detector.yml", ".osv-detector.yml"
9899
copy_file "variants/backend-base/.dockerignore", ".dockerignore"
99100

100101
apply "variants/backend-base/Rakefile.rb"
@@ -155,14 +156,13 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met
155156
end
156157

157158
binstubs = %w[
158-
brakeman bundler bundler-audit rubocop
159+
brakeman bundler rubocop
159160
]
160161
run_with_clean_bundler_env "bundle binstubs #{binstubs.join(" ")} --force"
161162

162163
template "variants/backend-base/rubocop.yml.tt", ".rubocop.yml"
163164
run_rubocop_autocorrections
164165

165-
apply "variants/frontend-audit-app/template.rb"
166166
apply "variants/frontend-base/js-lint/fixes.rb"
167167

168168
cleanup_package_json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore: []

variants/backend-base/Gemfile.tt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ group :development do
4444
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
4545
# gem "rack-mini-profiler"
4646

47-
gem "bundler-audit", require: false
4847
gem "brakeman", require: false
4948
gem "rubocop", require: false
5049
gem "rubocop-performance", require: false

variants/backend-base/bin/ci-run

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ echo "* ******************************************************"
1313
bundle exec rubocop -c ./.rubocop.yml
1414

1515
echo "* ******************************************************"
16-
echo "* Running bundle-audit"
16+
echo "* Running osv-detector"
1717
echo "* ******************************************************"
18-
bundle exec bundle-audit check --update
18+
# See https://github.com/G-Rath/osv-detector#installation for install details
19+
osv-detector .
1920

2021
echo "* ******************************************************"
2122
echo "* Running brakeman"

variants/frontend-audit-app/.auditapprc.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

variants/frontend-audit-app/template.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

variants/github_actions_ci/workflows/ci.yml.tt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ permissions:
2828
contents: read # to fetch code (actions/checkout)
2929

3030
jobs:
31+
audit_dependencies:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
with:
36+
persist-credentials: false
37+
- name: Audit dependencies for security vulnerabilities
38+
uses: g-rath/check-with-osv-detector@main
3139
js_based_checks:
3240
runs-on: ubuntu-latest
3341
timeout-minutes: 15
@@ -92,7 +100,6 @@ jobs:
92100
run: bundle exec chusaku --exit-with-error-on-annotation
93101
- run: bundle exec rubocop
94102
- run: bundle exec brakeman --run-all-checks --exit-on-warn --format plain .
95-
- run: bundle exec bundle audit --update
96103
- run: bundle exec rails db:setup
97104
- run: bundle exec rspec spec --format progress
98105
- name: Archive spec outputs
@@ -115,6 +122,7 @@ jobs:
115122
# deploy_to_ec2_staging:
116123
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
117124
# needs:
125+
# - audit_dependencies
118126
# - ruby_based_checks
119127
# - js_based_checks
120128
# uses: ./.github/workflows/deploy_to_ec2.yml
@@ -131,6 +139,7 @@ jobs:
131139
# deploy_to_ec2_production:
132140
# if: github.event_name == 'push' && github.ref == 'refs/heads/production'
133141
# needs:
142+
# - audit_dependencies
134143
# - ruby_based_checks
135144
# - js_based_checks
136145
# uses: ./.github/workflows/deploy_to_ec2.yml
@@ -152,6 +161,7 @@ jobs:
152161
# deploy_to_heroku_staging:
153162
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
154163
# needs:
164+
# - audit_dependencies
155165
# - ruby_based_checks
156166
# - js_based_checks
157167
# uses: ./.github/workflows/deploy_to_heroku.yml
@@ -165,6 +175,7 @@ jobs:
165175
# deploy_to_heroku_production:
166176
# if: github.event_name == 'push' && github.ref == 'refs/heads/production'
167177
# needs:
178+
# - audit_dependencies
168179
# - ruby_based_checks
169180
# - js_based_checks
170181
# uses: ./.github/workflows/deploy_to_heroku.yml

0 commit comments

Comments
 (0)