rails_template_18f 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +0 -43
- data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +17 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml +17 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +3 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +3 -1
- data/lib/generators/rails_template18f/rails_erd/rails_erd_generator.rb +49 -0
- data/lib/generators/rails_template18f/rails_erd/templates/erdconfig +9 -0
- data/lib/rails_template18f/generators/pipeline_options.rb +13 -4
- data/lib/rails_template18f/version.rb +1 -1
- data/template.rb +3 -1
- data/templates/doc/compliance/README.md +7 -2
- metadata +4 -3
- data/templates/doc/compliance/apps/data.logical.md +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc4a62d027d473b29b87425d2418522373457ae750a3bfa1e7d5834f3e3d39f
|
4
|
+
data.tar.gz: 88d86b8508c80de0b0593ca4852a789442e4ac5e84324c074e866bc85d50de37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8145b8f45a774296b8ea2add76694855f5c618e5900e2dcb4528666c6a855913d5a8eace278d1f208bce0ff1fa23818544bf1a931b11e88856451684fa6a465
|
7
|
+
data.tar.gz: ef237cfc40495ef9bece29583ad4007c08631e5cfd092e9415914442ffa588302a980f4fef1584d520827df970a791d1633a43cbe90e8d5eb72c036be7e84a0c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.8.0] - 2022-07-14
|
4
|
+
|
5
|
+
- use rails-erd gem for auto-updating logical data models
|
6
|
+
- use cleaner multi-line strings for GitHub Actions deploy steps
|
7
|
+
- generate an SBOM for ruby dependencies in either Github Actions or CircleCI using cyclonedx-ruby
|
8
|
+
|
3
9
|
## [0.7.2] - 2022-07-07
|
4
10
|
|
5
11
|
- update default node version in github actions to 16.15
|
data/Gemfile.lock
CHANGED
@@ -86,10 +86,6 @@ module RailsTemplate18f
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
def update_data_model_uml
|
90
|
-
insert_into_file "doc/compliance/apps/data.logical.md", data_model_uml, before: "@enduml"
|
91
|
-
end
|
92
|
-
|
93
89
|
def generate_adr
|
94
90
|
adr_dir = File.expand_path(File.join("doc", "adr"), destination_root)
|
95
91
|
if Dir.exist? adr_dir
|
@@ -108,45 +104,6 @@ module RailsTemplate18f
|
|
108
104
|
EOS
|
109
105
|
end
|
110
106
|
end
|
111
|
-
|
112
|
-
no_tasks do
|
113
|
-
def data_model_uml
|
114
|
-
<<~UML
|
115
|
-
class file_uploads {
|
116
|
-
* id : bigint <<generated>>
|
117
|
-
* scan_status : string
|
118
|
-
* record_id : bigint
|
119
|
-
* record_type : string
|
120
|
-
}
|
121
|
-
class active_storage_attachments {
|
122
|
-
* id : bigint <<generated>>
|
123
|
-
* name : string
|
124
|
-
* record_type : string
|
125
|
-
* record_id : bigint
|
126
|
-
* blob_id : bigint
|
127
|
-
* created_at : timestamp without time zone
|
128
|
-
}
|
129
|
-
class active_storage_blobs {
|
130
|
-
* id : bigint <<generated>>
|
131
|
-
* key : string
|
132
|
-
* filename : string
|
133
|
-
content_type : string
|
134
|
-
metadata : text
|
135
|
-
* service_name : string
|
136
|
-
* byte_size : bigint
|
137
|
-
checksum : string
|
138
|
-
* created_at : timestamp without time zone
|
139
|
-
}
|
140
|
-
class active_storage_variant_records {
|
141
|
-
* id : bigint <<generated>>
|
142
|
-
* variation_digest : string
|
143
|
-
}
|
144
|
-
file_uploads ||--|| active_storage_attachments
|
145
|
-
active_storage_attachments ||--|{ active_storage_blobs
|
146
|
-
active_storage_variant_records ||--|{ active_storage_blobs
|
147
|
-
UML
|
148
|
-
end
|
149
|
-
end
|
150
107
|
end
|
151
108
|
end
|
152
109
|
end
|
@@ -133,6 +133,20 @@ jobs:
|
|
133
133
|
name: Yarn audit
|
134
134
|
command: bundle exec rake yarn:audit
|
135
135
|
|
136
|
+
sbom_generation:
|
137
|
+
docker:
|
138
|
+
- image: cimg/ruby:<%= ruby_version %>
|
139
|
+
steps:
|
140
|
+
- setup-project
|
141
|
+
- run:
|
142
|
+
name: Install cyclonedx
|
143
|
+
command: gem install cyclonedx-ruby
|
144
|
+
- run:
|
145
|
+
name: Generate BOM
|
146
|
+
command: cyclonedx-ruby -p . -o ruby_bom.xml
|
147
|
+
- store_artifacts:
|
148
|
+
path: ./ruby_bom.xml
|
149
|
+
|
136
150
|
owasp_scan:
|
137
151
|
machine:
|
138
152
|
image: ubuntu-2004:202111-02
|
@@ -343,6 +357,9 @@ workflows:
|
|
343
357
|
- static_security_scans:
|
344
358
|
requires:
|
345
359
|
- build
|
360
|
+
- sbom_generation:
|
361
|
+
requires:
|
362
|
+
- build
|
346
363
|
- owasp_scan:
|
347
364
|
requires:
|
348
365
|
- build
|
data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml
CHANGED
@@ -37,3 +37,20 @@ jobs:
|
|
37
37
|
|
38
38
|
- name: Run yarn audit
|
39
39
|
run: bundle exec rake yarn:audit
|
40
|
+
|
41
|
+
ruby-bom:
|
42
|
+
name: Ruby SBOM Generation
|
43
|
+
runs-on: ubuntu-latest
|
44
|
+
|
45
|
+
steps:
|
46
|
+
- uses: actions/checkout@v2
|
47
|
+
- uses: ./.github/actions/setup-languages
|
48
|
+
- name: Install cyclonedx
|
49
|
+
run: gem install cyclonedx-ruby
|
50
|
+
- name: Generate BOM
|
51
|
+
run: cyclonedx-ruby -p . -o ruby_bom.xml
|
52
|
+
- name: Save BOM
|
53
|
+
uses: actions/upload-artifact@v3
|
54
|
+
with:
|
55
|
+
name: ruby-bom
|
56
|
+
path: ./ruby_bom.xml
|
@@ -50,4 +50,6 @@ jobs:
|
|
50
50
|
cf_password: ${{ secrets.CF_PASSWORD }}
|
51
51
|
cf_org: <%= cloud_gov_organization %>
|
52
52
|
cf_space: <%= cloud_gov_production_space %>
|
53
|
-
push_arguments:
|
53
|
+
push_arguments: >-
|
54
|
+
--vars-file config/deployment/production.yml
|
55
|
+
--var rails_master_key=$RAILS_MASTER_KEY
|
@@ -50,4 +50,6 @@ jobs:
|
|
50
50
|
cf_password: ${{ secrets.CF_PASSWORD }}
|
51
51
|
cf_org: <%= cloud_gov_organization %>
|
52
52
|
cf_space: <%= cloud_gov_staging_space %>
|
53
|
-
push_arguments:
|
53
|
+
push_arguments: >-
|
54
|
+
--vars-file config/deployment/staging.yml
|
55
|
+
--var rails_master_key=$RAILS_MASTER_KEY
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators"
|
4
|
+
|
5
|
+
module RailsTemplate18f
|
6
|
+
module Generators
|
7
|
+
class RailsErdGenerator < ::Rails::Generators::Base
|
8
|
+
include Base
|
9
|
+
|
10
|
+
desc <<~DESC
|
11
|
+
Description:
|
12
|
+
Install rails-erd and configure to automatically run on db migration
|
13
|
+
DESC
|
14
|
+
|
15
|
+
def install_graphviz
|
16
|
+
append_to_file "Brewfile", <<~EOB
|
17
|
+
|
18
|
+
# used by rails-erd documentation tool
|
19
|
+
brew "graphviz"
|
20
|
+
EOB
|
21
|
+
end
|
22
|
+
|
23
|
+
def install_gem
|
24
|
+
return if gem_installed?("rails-erd")
|
25
|
+
gem "rails-erd", "~> 1.7", group: :development
|
26
|
+
end
|
27
|
+
|
28
|
+
def install_helper_tasks
|
29
|
+
bundle_install do
|
30
|
+
generate "erd:install"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def copy_config
|
35
|
+
copy_file "erdconfig", ".erdconfig"
|
36
|
+
end
|
37
|
+
|
38
|
+
def update_readme
|
39
|
+
insert_into_file "doc/compliance/README.md", <<~EOM, before: "## Development"
|
40
|
+
### Logical Data Model
|
41
|
+
|
42
|
+
The logical data model will be auto-generated on each database migration.
|
43
|
+
The rendered output is saved to doc/compliance/rendered/apps/data.logical.pdf
|
44
|
+
|
45
|
+
EOM
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -17,14 +17,15 @@ module RailsTemplate18f
|
|
17
17
|
def update_cicd_oscal_docs(ci_name)
|
18
18
|
if oscal_dir_exists?
|
19
19
|
update_ca7_oscal_doc
|
20
|
-
update_cm2_oscal_doc(
|
21
|
-
update_cm3_oscal_doc(
|
20
|
+
update_cm2_oscal_doc(ci_name)
|
21
|
+
update_cm3_oscal_doc(ci_name)
|
22
22
|
update_ra5_oscal_doc
|
23
|
-
update_sa11_oscal_doc(
|
23
|
+
update_sa11_oscal_doc(ci_name)
|
24
24
|
update_sa22_oscal_doc
|
25
|
-
update_sc281_oscal_doc(
|
25
|
+
update_sc281_oscal_doc(ci_name)
|
26
26
|
update_si2_oscal_doc
|
27
27
|
update_si10_oscal_doc
|
28
|
+
update_sr3_oscal_doc(ci_name)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -176,6 +177,14 @@ module RailsTemplate18f
|
|
176
177
|
that may lead to application vulnerabilities that are a result of improper input validation.
|
177
178
|
EOS
|
178
179
|
end
|
180
|
+
|
181
|
+
def update_sr3_oscal_doc(ci)
|
182
|
+
insert_into_oscal "sr-3.md", <<~EOS, after: "Implementation b.\n"
|
183
|
+
A complete Software Bill of Materials (SBOM) for all Ruby dependencies is automatically
|
184
|
+
generated by #{ci} on each push to GitHub as well as on a nightly basis. These can be downloaded
|
185
|
+
from the applicable artifact section for each CI job.
|
186
|
+
EOS
|
187
|
+
end
|
179
188
|
end
|
180
189
|
end
|
181
190
|
end
|
data/template.rb
CHANGED
@@ -319,8 +319,10 @@ end
|
|
319
319
|
directory "doc"
|
320
320
|
register_announcement("Documentation", <<~EOM)
|
321
321
|
* Include a short description of your application in doc/compliance/apps/application.boundary.md
|
322
|
-
* Remember to keep your Logical Data Model up to date in doc/compliance/apps/data.logical.md
|
323
322
|
EOM
|
323
|
+
after_bundle do
|
324
|
+
generate "rails_template18f:rails_erd"
|
325
|
+
end
|
324
326
|
|
325
327
|
if compliance_template
|
326
328
|
after_bundle do
|
@@ -1,13 +1,18 @@
|
|
1
1
|
# Compliance artifacts
|
2
2
|
|
3
|
-
## What is this?
|
4
|
-
|
5
3
|
In order to maintain and revise compliance materials with minimal fuss, we store all artifacts as text source (eg Markdown, PlantUML, OSCAL), then generate rendered materials for consumption by downstream entities in the assessment and authorization process.
|
6
4
|
|
7
5
|
This directory initially just contains system architecture diagrams corresponding to sections 1-12 of a typical System Security Plan (SSP) document.
|
8
6
|
|
9
7
|
The source for other things (OSCAL for control descriptions, evidence generation scripts, etc) will appear here over time.
|
10
8
|
|
9
|
+
## Documents
|
10
|
+
|
11
|
+
### Application Boundary
|
12
|
+
|
13
|
+
The UML source of the application boundary is stored at doc/compliance/apps/application.boundary.md.
|
14
|
+
The rendered output is saved to doc/compliance/rendered/apps/application.boundary.svg
|
15
|
+
|
11
16
|
## Development
|
12
17
|
|
13
18
|
These plugins may be helpful for editing diagrams.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_template_18f
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ahearn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -167,6 +167,8 @@ files:
|
|
167
167
|
- lib/generators/rails_template18f/newrelic/newrelic_generator.rb
|
168
168
|
- lib/generators/rails_template18f/newrelic/templates/config/newrelic.yml.tt
|
169
169
|
- lib/generators/rails_template18f/oscal/oscal_generator.rb
|
170
|
+
- lib/generators/rails_template18f/rails_erd/rails_erd_generator.rb
|
171
|
+
- lib/generators/rails_template18f/rails_erd/templates/erdconfig
|
170
172
|
- lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb
|
171
173
|
- lib/generators/rails_template18f/sidekiq/templates/config/initializers/redis.rb
|
172
174
|
- lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt
|
@@ -235,7 +237,6 @@ files:
|
|
235
237
|
- templates/doc/adr/0004-rails-csp-compliant-script-tag-helpers.md.tt
|
236
238
|
- templates/doc/compliance/README.md
|
237
239
|
- templates/doc/compliance/apps/application.boundary.md.tt
|
238
|
-
- templates/doc/compliance/apps/data.logical.md
|
239
240
|
- templates/doc/compliance/rendered/apps/.keep
|
240
241
|
- templates/editorconfig
|
241
242
|
- templates/env
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Logical Data Model
|
2
|
-
|
3
|
-
![logical data model view](../rendered/apps/data.logical.svg)
|
4
|
-
|
5
|
-
```plantuml
|
6
|
-
@startuml
|
7
|
-
scale 0.65
|
8
|
-
|
9
|
-
' avoid problems with angled crows feet
|
10
|
-
skinparam linetype ortho
|
11
|
-
|
12
|
-
class TKTK_Example {
|
13
|
-
* id : integer <<generated>>
|
14
|
-
}
|
15
|
-
@enduml
|
16
|
-
```
|
17
|
-
|
18
|
-
### Notes
|
19
|
-
|
20
|
-
* See the help docs for [Entity Relationship Diagram](https://plantuml.com/ie-diagram) and [Class Diagram](https://plantuml.com/class-diagram) for syntax help.
|
21
|
-
* We're using the `*` visibility modifier to denote fields that cannot be `null`.
|