Skip to content

Commit 4d37d61

Browse files
committed
Add CI actions
1 parent e1f999e commit 4d37d61

File tree

3 files changed

+132
-2
lines changed

3 files changed

+132
-2
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: bundler
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: github-actions
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
scan_ruby:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: .ruby-version
20+
bundler-cache: true
21+
22+
- name: Scan for common Rails security vulnerabilities using static analysis
23+
run: bin/brakeman --no-pager --skip-files storage/
24+
25+
scan_js:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Ruby
33+
uses: ruby/setup-ruby@v1
34+
with:
35+
ruby-version: .ruby-version
36+
bundler-cache: true
37+
38+
- name: Scan for security vulnerabilities in JavaScript dependencies
39+
run: bin/importmap audit
40+
41+
lint:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Ruby
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: .ruby-version
51+
bundler-cache: true
52+
53+
- name: Lint code for consistent style
54+
run: bin/rubocop -f github
55+
56+
test:
57+
runs-on: ubuntu-latest
58+
59+
services:
60+
db:
61+
image: postgres:alpine
62+
env:
63+
POSTGRES_USER: db
64+
POSTGRES_PASSWORD: db
65+
ports:
66+
- 5432:5432
67+
options: --health-cmd "pg_isready" --health-interval 10s --health-timeout 5s --health-retries 5
68+
steps:
69+
- name: Install packages
70+
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config google-chrome-stable
71+
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
75+
- name: Set up Ruby
76+
uses: ruby/setup-ruby@v1
77+
with:
78+
ruby-version: .ruby-version
79+
bundler-cache: true
80+
81+
- name: Zeitwerk
82+
run: bin/rails zeitwerk:check
83+
84+
- name: Run tests
85+
env:
86+
RAILS_ENV: test
87+
run: bin/rails db:test:prepare test test:system
88+
89+
- name: Keep screenshots from failed system tests
90+
uses: actions/upload-artifact@v4
91+
if: failure()
92+
with:
93+
name: screenshots
94+
path: ${{ github.workspace }}/tmp/screenshots
95+
if-no-files-found: ignore

config/brakeman.ignore

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
"check_name": "CrossSiteScripting",
5454
"message": "Unescaped model attribute",
5555
"file": "app/views/shared/_library.html.erb",
56-
"line": 5,
56+
"line": 6,
5757
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
5858
"code": "sorted_versions((Unresolved Model).new).reverse[(1..3)].map do\n link_to_library((Unresolved Model).new, v)\n end.join(\", \")",
5959
"render_path": [
6060
{
6161
"type": "template",
6262
"name": "shared/library_list",
63-
"line": 18,
63+
"line": 4,
6464
"file": "app/views/shared/library_list.html.erb",
6565
"rendered": {
6666
"name": "shared/_library",
@@ -148,6 +148,29 @@
148148
],
149149
"note": ""
150150
},
151+
{
152+
"warning_type": "Command Injection",
153+
"warning_code": 14,
154+
"fingerprint": "d70a014243f6f96cb39177011097a6d11741c760f176bbd6d5b3152536ddbe9e",
155+
"check_name": "Execute",
156+
"message": "Possible command injection",
157+
"file": "app/jobs/reap_generate_docs_job.rb",
158+
"line": 8,
159+
"link": "https://brakemanscanner.org/docs/warning_types/command_injection/",
160+
"code": "`docker rm -f #{id}`",
161+
"render_path": null,
162+
"location": {
163+
"type": "method",
164+
"class": "ReapGenerateDocsJob",
165+
"method": "perform"
166+
},
167+
"user_input": "id",
168+
"confidence": "Medium",
169+
"cwe_id": [
170+
77
171+
],
172+
"note": ""
173+
},
151174
{
152175
"warning_type": "Command Injection",
153176
"warning_code": 14,

0 commit comments

Comments
 (0)