rails_template_18f 0.8.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/Gemfile.lock +58 -28
  4. data/README.md +5 -5
  5. data/Rakefile +12 -0
  6. data/SECURITY.md +18 -0
  7. data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +2 -9
  8. data/lib/generators/rails_template18f/active_storage/templates/oscal/component-definitions/active_storage/component-definition.json +69 -0
  9. data/lib/generators/rails_template18f/auditree/auditree_generator.rb +84 -0
  10. data/lib/generators/rails_template18f/auditree/templates/bin/auditree.tt +29 -0
  11. data/lib/generators/rails_template18f/auditree/templates/github/actions/auditree-cmd/action.yml.tt +31 -0
  12. data/lib/generators/rails_template18f/auditree/templates/github/workflows/auditree-validation.yml.tt +42 -0
  13. data/lib/generators/rails_template18f/circleci/circleci_generator.rb +3 -3
  14. data/lib/generators/rails_template18f/circleci/templates/bin/ci-server-start +1 -1
  15. data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +59 -16
  16. data/lib/generators/rails_template18f/circleci/templates/docker-compose.ci.yml +1 -0
  17. data/lib/generators/rails_template18f/circleci/templates/oscal/component-definitions/circleci/component-definition.json.tt +310 -0
  18. data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +7 -12
  19. data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-languages/action.yml.tt +1 -1
  20. data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt +1 -0
  21. data/lib/generators/rails_template18f/github_actions/templates/github/actions/trestle-cmd/action.yml +20 -0
  22. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/assemble-ssp.yml.tt +26 -0
  23. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/brakeman-analysis.yml +6 -2
  24. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml +4 -4
  25. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +14 -25
  26. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +14 -25
  27. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt +8 -3
  28. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt +4 -3
  29. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt +6 -2
  30. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/rspec.yml.tt +1 -1
  31. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +20 -58
  32. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +20 -58
  33. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/validate-ssp.yml.tt +46 -0
  34. data/lib/generators/rails_template18f/github_actions/templates/oscal/component-definitions/github_actions/component-definition.json.tt +310 -0
  35. data/lib/generators/rails_template18f/i18n/i18n_generator.rb +7 -6
  36. data/lib/generators/rails_template18f/i18n/templates/config/locales/en.yml.tt +1 -0
  37. data/lib/generators/rails_template18f/i18n/templates/config/locales/es.yml +2 -0
  38. data/lib/generators/rails_template18f/i18n/templates/config/locales/fr.yml +2 -0
  39. data/lib/generators/rails_template18f/i18n/templates/config/locales/zh.yml +2 -0
  40. data/lib/generators/rails_template18f/newrelic/newrelic_generator.rb +2 -37
  41. data/lib/generators/rails_template18f/newrelic/templates/oscal/component-definitions/newrelic/component-definition.json.tt +113 -0
  42. data/lib/generators/rails_template18f/oscal/oscal_generator.rb +55 -17
  43. data/lib/generators/rails_template18f/oscal/templates/bin/trestle.tt +10 -0
  44. data/lib/generators/rails_template18f/oscal/templates/doc/compliance/oscal/trestle-config.yaml.tt +6 -0
  45. data/lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb +2 -2
  46. data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +1 -1
  47. data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +4 -4
  48. data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt +0 -1
  49. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +4 -4
  50. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf.tt +0 -1
  51. data/lib/rails_template18f/generators/base.rb +9 -24
  52. data/lib/rails_template18f/generators/pipeline_options.rb +0 -172
  53. data/lib/rails_template18f/version.rb +1 -1
  54. data/rails-template-18f.gemspec +6 -6
  55. data/railsrc +1 -0
  56. data/railsrc-hotwire +1 -0
  57. data/template.rb +56 -44
  58. data/templates/Brewfile +2 -2
  59. data/templates/README.md.tt +3 -4
  60. data/templates/app/assets/stylesheets/uswds-components.scss +6 -0
  61. data/templates/app/assets/stylesheets/uswds-overrides/_index.scss +2 -0
  62. data/templates/app/assets/stylesheets/uswds-overrides/_override-usa-banner.scss +13 -0
  63. data/templates/app/assets/stylesheets/uswds-overrides/_override-usa-language-selector.scss +38 -0
  64. data/templates/app/views/application/_header.html.erb +6 -5
  65. data/templates/app/views/application/_language_selector.html.erb +35 -0
  66. data/templates/app/views/application/_usa_banner.html.erb +21 -16
  67. data/templates/bin/owasp-scan +3 -3
  68. data/templates/bin/pa11y-scan +1 -1
  69. data/templates/config/environments/ci.rb +1 -0
  70. data/templates/manifest.yml.tt +0 -1
  71. data/templates/pa11y.js +12 -0
  72. data/templates/pa11yci.js +8 -0
  73. metadata +35 -16
  74. data/templates/pa11yci +0 -9
  75. /data/lib/generators/rails_template18f/circleci/templates/{Dockerfile.tt → Dockerfile.ci.tt} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f972115a1f66ddfefa4341186434fe24a4e78b201ad192786a4c5d34bebb8c
4
- data.tar.gz: dcbf65cd0f011f12aa918975b426e23002d07c54c14d4251d5e8102bc59e74a3
3
+ metadata.gz: ea2ec3406d7768825b772437242ea1b106d635ef1e4231b0a3c5b7959c88574f
4
+ data.tar.gz: edce599ccfdb6455e5dd8a781aecd37c54ec1d94045aba71735d9262885070e1
5
5
  SHA512:
6
- metadata.gz: '09de09463925281bdb7731686bebfe8eb4441a208e488597abfc910510dead294a0380629ed43af55956fb798fa2aeffeaddc25c0b6e2dd6e584db6791b211b0'
7
- data.tar.gz: d12d2667e1aa2bf8e49097ccc9b3f76656a5a71b5ca829b1e02361d33df62af298c27dfe6de8da268f6ead509a54725c1df5852813196bd113f1daedf9f70de4
6
+ metadata.gz: 6b1cd11a24976b6eeb067ac5ff3dc050c6e049dc2e5875d55b24b269059233b7503cb9eeeb6f70df78543dd30e6a69bc9cbaf8d15f9b38aba7e568847f830bd4
7
+ data.tar.gz: 3cbeed2a16a2f6b89d31f193540556b56e12fa575f659feb513ba75cfea06b1bb19f7fcfcae501fc0ec576a8dead1d7bca87d058c67d3db605611bc6f6551eb2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+
4
+ ## [1.1.0] - 2024-08-20
5
+
6
+ - add an auditree generator for integration with auditree-devtools and github actions to run it
7
+ - remove the obsolete entry to include nodejs_buildpack in cloud.gov manifest.yml
8
+
9
+ ## [1.0.0] - 2024-06-27
10
+
11
+ - new applications are now on Rails 7.1.x
12
+ - implement USWDS language selector component when translation files are included
13
+ - cleans up github actions and circleci generators to address bitrot
14
+ - utilize docker-trestle project for OSCAL integration / compliance as code
15
+
3
16
  ## [0.8.2] - 2024-06-06
4
17
 
5
18
  - Replace deprecated github action for cloud.gov deploys with cg-supported one
data/Gemfile.lock CHANGED
@@ -1,55 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_template_18f (0.8.2)
5
- activesupport (~> 7.0.0)
6
- colorize (~> 0.8)
7
- railties (~> 7.0.0)
8
- thor (~> 1.0)
4
+ rails_template_18f (1.1.0)
5
+ activesupport (~> 7.1.0)
6
+ colorize (~> 1.1)
7
+ railties (~> 7.1.0)
8
+ thor (~> 1.3)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (7.0.8.4)
14
- actionview (= 7.0.8.4)
15
- activesupport (= 7.0.8.4)
16
- rack (~> 2.0, >= 2.2.4)
13
+ actionpack (7.1.3.4)
14
+ actionview (= 7.1.3.4)
15
+ activesupport (= 7.1.3.4)
16
+ nokogiri (>= 1.8.5)
17
+ racc
18
+ rack (>= 2.2.4)
19
+ rack-session (>= 1.0.1)
17
20
  rack-test (>= 0.6.3)
18
- rails-dom-testing (~> 2.0)
19
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
- actionview (7.0.8.4)
21
- activesupport (= 7.0.8.4)
21
+ rails-dom-testing (~> 2.2)
22
+ rails-html-sanitizer (~> 1.6)
23
+ actionview (7.1.3.4)
24
+ activesupport (= 7.1.3.4)
22
25
  builder (~> 3.1)
23
- erubi (~> 1.4)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
- activesupport (7.0.8.4)
26
+ erubi (~> 1.11)
27
+ rails-dom-testing (~> 2.2)
28
+ rails-html-sanitizer (~> 1.6)
29
+ activesupport (7.1.3.4)
30
+ base64
31
+ bigdecimal
27
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
+ connection_pool (>= 2.2.5)
34
+ drb
28
35
  i18n (>= 1.6, < 2)
29
36
  minitest (>= 5.1)
37
+ mutex_m
30
38
  tzinfo (~> 2.0)
31
39
  ammeter (1.1.7)
32
40
  activesupport (>= 3.0)
33
41
  railties (>= 3.0)
34
42
  rspec-rails (>= 2.2)
35
43
  ast (2.4.2)
44
+ base64 (0.2.0)
45
+ bigdecimal (3.1.8)
36
46
  builder (3.2.4)
37
47
  byebug (11.1.3)
38
- colorize (0.8.1)
48
+ colorize (1.1.0)
39
49
  concurrent-ruby (1.3.1)
50
+ connection_pool (2.4.1)
40
51
  crass (1.0.6)
41
52
  diff-lcs (1.5.1)
53
+ drb (2.2.1)
42
54
  erubi (1.12.0)
43
55
  i18n (1.14.5)
44
56
  concurrent-ruby (~> 1.0)
57
+ io-console (0.7.2)
58
+ irb (1.13.1)
59
+ rdoc (>= 4.0.0)
60
+ reline (>= 0.4.2)
45
61
  json (2.7.2)
46
62
  language_server-protocol (3.17.0.3)
47
63
  lint_roller (1.1.0)
48
64
  loofah (2.22.0)
49
65
  crass (~> 1.0.2)
50
66
  nokogiri (>= 1.12.0)
51
- method_source (1.1.0)
52
67
  minitest (5.23.1)
68
+ mutex_m (0.2.0)
53
69
  nokogiri (1.16.5-arm64-darwin)
54
70
  racc (~> 1.4)
55
71
  nokogiri (1.16.5-x86_64-darwin)
@@ -60,10 +76,17 @@ GEM
60
76
  parser (3.3.2.0)
61
77
  ast (~> 2.4.1)
62
78
  racc
79
+ psych (5.1.2)
80
+ stringio
63
81
  racc (1.8.0)
64
- rack (2.2.9)
82
+ rack (3.0.11)
83
+ rack-session (2.0.0)
84
+ rack (>= 3.0.0)
65
85
  rack-test (2.1.0)
66
86
  rack (>= 1.3)
87
+ rackup (2.1.0)
88
+ rack (>= 3)
89
+ webrick (~> 1.8)
67
90
  rails-dom-testing (2.2.0)
68
91
  activesupport (>= 5.0.0)
69
92
  minitest
@@ -71,16 +94,21 @@ GEM
71
94
  rails-html-sanitizer (1.6.0)
72
95
  loofah (~> 2.21)
73
96
  nokogiri (~> 1.14)
74
- railties (7.0.8.4)
75
- actionpack (= 7.0.8.4)
76
- activesupport (= 7.0.8.4)
77
- method_source
97
+ railties (7.1.3.4)
98
+ actionpack (= 7.1.3.4)
99
+ activesupport (= 7.1.3.4)
100
+ irb
101
+ rackup (>= 1.0.0)
78
102
  rake (>= 12.2)
79
- thor (~> 1.0)
80
- zeitwerk (~> 2.5)
103
+ thor (~> 1.0, >= 1.2.2)
104
+ zeitwerk (~> 2.6)
81
105
  rainbow (3.1.1)
82
106
  rake (13.2.1)
107
+ rdoc (6.7.0)
108
+ psych (>= 4.0.0)
83
109
  regexp_parser (2.9.2)
110
+ reline (0.5.8)
111
+ io-console (~> 0.5)
84
112
  rexml (3.2.8)
85
113
  strscan (>= 3.0.9)
86
114
  rspec (3.13.0)
@@ -133,11 +161,13 @@ GEM
133
161
  standard-performance (1.4.0)
134
162
  lint_roller (~> 1.1)
135
163
  rubocop-performance (~> 1.21.0)
164
+ stringio (3.1.0)
136
165
  strscan (3.1.0)
137
166
  thor (1.3.1)
138
167
  tzinfo (2.0.6)
139
168
  concurrent-ruby (~> 1.0)
140
169
  unicode-display_width (2.5.0)
170
+ webrick (1.8.1)
141
171
  zeitwerk (2.6.15)
142
172
 
143
173
  PLATFORMS
@@ -151,8 +181,8 @@ DEPENDENCIES
151
181
  byebug
152
182
  rails_template_18f!
153
183
  rake (~> 13.0)
154
- rspec (~> 3.11)
155
- standard (~> 1.3)
184
+ rspec (~> 3.13)
185
+ standard (~> 1.36)
156
186
 
157
187
  BUNDLED WITH
158
188
  2.3.15
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
  ============================
3
3
  The 18F Rails template starts or upgrades Rails projects so that they're more secure, follow compliance rules, and are nearly ready to deploy onto cloud.gov. This gem sets up security checks and compliance diagrams, adds the U.S. Web Design System (USWDS), and much much more — [see the full list of features](#features).
4
4
 
5
- This template will create a new Rails 7.0.x project.
5
+ This template will create a new Rails 7.1.x project.
6
6
 
7
- [See the `rails-6` branch for Rails 6.1.x](https://github.com/18F/rails-template/tree/rails-6)
7
+ [See the `rails-7.0` branch for Rails 7.0.x](https://github.com/gsa-tts/rails-template/tree/rails-7.0)
8
8
 
9
9
  ## Installation
10
10
 
@@ -43,6 +43,7 @@ There are a variety of options that customize your Rails application.
43
43
  --skip-action-cable # Don't include ActionCable websocket implementation
44
44
  --skip-action-mailbox # Don't include inbound email
45
45
  --skip-hotwire # Don't include Hotwire JS library
46
+ --skip-docker # Don't include Dockerfile meant for production use
46
47
  --skip-test # Skip built-in test framework. (We include RSpec)
47
48
  --javascript=webpack # Use webpack for JS bundling
48
49
  --css=postcss # Use the PostCSS framework for bundling CSS
@@ -56,7 +57,6 @@ There are a variety of options that customize your Rails application.
56
57
  |--------|-------------|
57
58
  | `--no-skip-<framework>` | Each of the skipped frameworks listed above (also in `railsrc`) can be overridden on the command line. For example: `--no-skip-active-storage` will include support for `ActiveStorage` document uploads |
58
59
  | `--javascript=esbuild` | Use [esbuild](https://esbuild.github.io/) instead of [webpack](https://webpack.js.org/) for JavaScript bundling. Note that maintaining IE11 support with esbuild may be tricky. |
59
- | `--no-skip-<FRAMEWORK>` | Each of the skipped frameworks in `railsrc` can be overridden on the command line. For example: `--no-skip-active-storage` will include support for `ActiveStorage` document uploads |
60
60
 
61
61
  You probably won't want to customize the template — that defeats the purpose of using this gem!
62
62
 
@@ -128,8 +128,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
128
128
 
129
129
  ## Contributing
130
130
 
131
- Bug reports and pull requests are welcome on GitHub at https://github.com/18f/rails-template. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/18f/rails-template/blob/main/CODE_OF_CONDUCT.md).
131
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gsa-tts/rails-template. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/gsa-tts/rails-template/blob/main/CODE_OF_CONDUCT.md).
132
132
 
133
133
  ## Code of conduct
134
134
 
135
- Everyone interacting in the 18F Rails Template project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rahearn/rails-template-18f/blob/main/CODE_OF_CONDUCT.md).
135
+ Everyone interacting in the 18F Rails Template project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/gsa-tts/rails-template/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -8,3 +8,15 @@ RSpec::Core::RakeTask.new(:spec)
8
8
  require "standard/rake"
9
9
 
10
10
  task default: %i[spec standard]
11
+
12
+ task :release do
13
+ # adding a custom release task because I can't get the default `rake release` to play nicely with my
14
+ # passkey login to rubygems.org on GFE, so I need to use the `gem push --otp` version.
15
+ # set the environment variable gem_push=false to enable this block
16
+ gemhelper = Bundler::GemHelper.instance
17
+ unless gemhelper.send :gem_push?
18
+ gemspec = gemhelper.gemspec
19
+ Bundler.ui.warn "Next step: publish the #{gemspec.name} gem with:"
20
+ Bundler.ui.warn "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem --otp OTP"
21
+ end
22
+ end
data/SECURITY.md ADDED
@@ -0,0 +1,18 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Only certain branches are supported with security updates.
6
+
7
+ | Version (branch) | Supported |
8
+ | ---------------- | ----------- |
9
+ | main | :white_check_mark: |
10
+ | rails-7.0 | :white_check_mark: |
11
+ | other | :x: |
12
+
13
+ When using this code or reporting vulnerability please be sure to use supported branches and the most recent release tag.
14
+
15
+ ## Reporting a Vulnerability
16
+
17
+ Use the `Report a vulnerability` link at https://github.com/GSA-TTS/rails-template/security to report a security vulnerability
18
+ on a supported branch of this repository.
@@ -94,15 +94,8 @@ module RailsTemplate18f
94
94
  end
95
95
  end
96
96
 
97
- def update_oscal_doc
98
- if oscal_dir_exists?
99
- insert_into_oscal "si-3.md", <<~EOS, after: "## Implementation a.\n"
100
- #{app_name} employs ClamAV to detect and quarantine malicious code in user-uploaded files.
101
- EOS
102
- insert_into_oscal "si-3.md", <<~EOS, after: "## Implementation b.\n"
103
- ClamAV is configured to automatically update malicious code detection signatures on a daily basis.
104
- EOS
105
- end
97
+ def update_oscal
98
+ copy_oscal_component "active_storage"
106
99
  end
107
100
  end
108
101
  end
@@ -0,0 +1,69 @@
1
+ {
2
+ "component-definition": {
3
+ "uuid": "6c8efe45-ab46-4d02-846e-5d58b4797a3e",
4
+ "metadata": {
5
+ "title": "ActiveStorage Component Definition.",
6
+ "last-modified": "2024-06-10T17:31:06.312964+00:00",
7
+ "version": "0.0.1",
8
+ "oscal-version": "1.1.2"
9
+ },
10
+ "components": [
11
+ {
12
+ "uuid": "a206dda7-d1f6-451c-8a0f-b6f4e8bf22d0",
13
+ "type": "software",
14
+ "title": "ClamAV",
15
+ "description": "ClamAV malware scanner",
16
+ "props": [
17
+ {
18
+ "name": "Rule_Id",
19
+ "value": "properly-configured",
20
+ "remarks": "rule_config"
21
+ },
22
+ {
23
+ "name": "Rule_Description",
24
+ "value": "System owner has configured the system to properly run the ClamAV scanner and send files to it on upload",
25
+ "remarks": "rule_config"
26
+ }
27
+ ],
28
+ "control-implementations": [
29
+ {
30
+ "uuid": "e1a02625-cb99-48e6-8240-90f2fdcc8481",
31
+ "source": "trestle://profiles/gsa-moderate/profile.json",
32
+ "description": "Controls satisfied via use of the ClamAV malware scanning app",
33
+ "implemented-requirements": [
34
+ {
35
+ "uuid": "4c53c056-dbbd-4889-b268-e1d50bc1fd88",
36
+ "control-id": "si-3",
37
+ "description": "",
38
+ "statements": [
39
+ {
40
+ "statement-id": "si-3_smt.a",
41
+ "uuid": "9621f3b7-878f-487a-bfa1-bbd9d2111e25",
42
+ "description": "The system employs ClamAV to detect and quarantine malicious code in user-uploaded files.",
43
+ "props": [
44
+ {
45
+ "name": "Rule_Id",
46
+ "value": "properly-configured"
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "statement-id": "si-3_smt.b",
52
+ "uuid": "850c1163-5c94-4018-9593-0f8e908ace2f",
53
+ "description": "ClamAV is configured to automatically update malicious code detection signatures on a daily basis.",
54
+ "props": [
55
+ {
56
+ "name": "Rule_Id",
57
+ "value": "properly-configured"
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ ]
68
+ }
69
+ }
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module RailsTemplate18f
6
+ module Generators
7
+ class AuditreeGenerator < ::Rails::Generators::Base
8
+ include Base
9
+
10
+ class_option :tag, desc: "Which auditree docker tag to use. Defaults to `latest`"
11
+ class_option :git_email, desc: "Email address to associate with commits to the evidence locker"
12
+
13
+ desc <<~DESC
14
+ Description:
15
+ Set up auditree validation checking with https://github.com/GSA-TTS/devtools-auditree.
16
+
17
+ This generator is still experimental.
18
+ DESC
19
+
20
+ def copy_bin
21
+ template "bin/auditree"
22
+ chmod "bin/auditree", 0o755
23
+ end
24
+
25
+ def copy_github_actions
26
+ if file_exists? ".github/workflows"
27
+ directory "github", ".github"
28
+ end
29
+ end
30
+
31
+ def update_readme
32
+ if file_content("README.md").match?("## Documentation")
33
+ insert_into_file "README.md", readme_contents, after: "## Documentation\n"
34
+ else
35
+ append_to_file "README.md", "\n## Documentation\n#{readme_contents}"
36
+ end
37
+ end
38
+
39
+ def update_component_list
40
+ if oscal_dir_exists?
41
+ insert_into_file "doc/compliance/oscal/trestle-config.yaml", " - devtools_cloud_gov\n"
42
+ end
43
+ end
44
+
45
+ no_tasks do
46
+ def docker_auditree_tag
47
+ options[:tag].present? ? options[:tag] : "latest"
48
+ end
49
+
50
+ def git_email
51
+ options[:git_email].present? ? options[:git_email] : "TKTK-email@gsa.gov"
52
+ end
53
+
54
+ def readme_contents
55
+ <<~README
56
+
57
+ ### Auditree Control Validation
58
+
59
+ Auditree is used within CI/CD to validate that certain controls are in place.
60
+
61
+ * Run `bin/auditree` to start the auditree CLI.
62
+ * Run `bin/auditree SCRIPT_NAME` to run a single auditree script
63
+
64
+ #### Initial auditree setup.
65
+
66
+ These steps must happen once per project.
67
+
68
+ 1. Docker desktop must be running
69
+ 1. Initialize the config file with `bin/auditree init > config/auditree.template.json`
70
+ 1. Create an evidence locker repository with a default or blank README
71
+ 1. Create a github personal access token to interact with the code repo and evidence locker and set as `AUDITREE_GITHUB_TOKEN` secret within your production Github environment secrets.
72
+ 1. Update `config/auditree.template.json` with the repo addresses for your locker and code repos
73
+ 1. Copy the `devtools_cloud_gov` component definition into the project with the latest docker-trestle
74
+
75
+ #### Ongoing use
76
+
77
+ See the [auditree-devtools README](https://github.com/gsa-tts/auditree-devtools) for help with updating
78
+ auditree and using new checks.
79
+ README
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,29 @@
1
+ #! /usr/bin/env bash
2
+ usage="
3
+ $0: Run auditree docker image.
4
+
5
+ Usage:
6
+ $0 -h
7
+ $0
8
+ $0 init > path/to/auditree.template.json
9
+ $0 fetch
10
+ $0 check > path/to/assessment-results/auditree/assessment-results.json
11
+
12
+ Notes:
13
+ The following environment variables will be passed through to the docker image:
14
+ * GITHUB_TOKEN - a token that has permissions to read and write to the evidence locker and code repository. Required for all but 'init'
15
+ * CF_USERNAME - the cloud.gov username to fetch evidence from cloud.gov, only needed when running fetch script
16
+ * CF_PASSWORD - the cloud.gov password to fetch evidence from cloud.gov, only needed when running fetch script
17
+ "
18
+
19
+ if [ "$1" = "-h" ]; then
20
+ echo "$usage"
21
+ exit 0
22
+ fi
23
+
24
+ command="bash"
25
+ if [ "$1" != "" ]; then
26
+ command=$1
27
+ fi
28
+
29
+ docker run -e GITHUB_TOKEN -e CF_USERNAME -e CF_PASSWORD -e GIT_EMAIL="<%= git_email %>" -it --rm ghcr.io/gsa-tts/auditree:<%= docker_auditree_tag %> $command
@@ -0,0 +1,31 @@
1
+ name: "Run an auditree-devtools command"
2
+ description: "Sets up workspace for running a single command in auditree-devtools"
3
+ inputs:
4
+ tag:
5
+ description: auditree-devtools tag to use. Defaults to <%= docker_auditree_tag %>
6
+ required: false
7
+ default: <%= docker_auditree_tag %>
8
+ cmd:
9
+ description: Command to run within auditree-devtools
10
+ required: true
11
+ email:
12
+ description: Git user email to attribute to evidence updates
13
+ required: true
14
+ config_template:
15
+ description: Auditree config file template
16
+ required: false
17
+ default: config/auditree.template.json
18
+ cdef:
19
+ description: OSCAL Component Definition being used as baseline for assessment results
20
+ required: false
21
+ default: doc/compliance/oscal/component-definitions/devtools_cloud_gov/component-definition.json
22
+ runs:
23
+ using: "composite"
24
+ steps:
25
+ - name: Run cmd
26
+ shell: bash
27
+ run:
28
+ docker run -v $GITHUB_WORKSPACE/${{inputs.config_template}}:/app/auditree.template.json:ro
29
+ -v $GITHUB_WORKSPACE/${{inputs.cdef}}:/app/cdef.json:ro
30
+ -e GITHUB_TOKEN -e CF_USERNAME -e CF_PASSWORD -e GIT_EMAIL="${{inputs.email}}"
31
+ ghcr.io/gsa-tts/auditree:${{ inputs.tag }} ${{ inputs.cmd }}
@@ -0,0 +1,42 @@
1
+ name: Run Auditree Checks
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ # cron format: 'minute hour dayofmonth month dayofweek'
7
+ # this will run at 11am UTC every day (6am EST / 7am EDT)
8
+ - cron: '0 11 * * *'
9
+
10
+ jobs:
11
+ run_auditree:
12
+ name: Fetch and check auditree evidence
13
+ runs-on: ubuntu-latest
14
+ environment: production
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Fetch evidence
19
+ uses: ./.github/actions/auditree-cmd
20
+ env:
21
+ CF_USERNAME: ${{ secrets.CF_USERNAME }}
22
+ CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
23
+ GITHUB_TOKEN: ${{ secrets.AUDITREE_GITHUB_TOKEN }}
24
+ with:
25
+ cmd: fetch
26
+ email: "<%= git_email %>"
27
+
28
+ - name: Check evidence
29
+ uses: ./.github/actions/auditree-cmd
30
+ env:
31
+ CF_USERNAME: ${{ secrets.CF_USERNAME }}
32
+ CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
33
+ GITHUB_TOKEN: ${{ secrets.AUDITREE_GITHUB_TOKEN }}
34
+ with:
35
+ cmd: check > doc/compliance/oscal/assessment-results/auditree/assessment-results.json
36
+ email: "<%= git_email %>"
37
+
38
+ - name: Save results
39
+ uses: actions/upload-artifact@v4
40
+ with:
41
+ name: auditree_assessment_results
42
+ path: doc/compliance/oscal/assessment-results/auditree
@@ -16,14 +16,14 @@ module RailsTemplate18f
16
16
  def install_needed_gems
17
17
  gem_name = "rspec_junit_formatter"
18
18
  return if gem_installed? gem_name
19
- gem gem_name, "~> 0.5", group: :test
19
+ gem gem_name, "~> 0.6", group: :test
20
20
  bundle_install
21
21
  end
22
22
 
23
23
  def install_pipeline
24
24
  directory "circleci", ".circleci"
25
25
  copy_file "docker-compose.ci.yml"
26
- template "Dockerfile"
26
+ template "Dockerfile.ci"
27
27
  copy_file "bin/ci-server-start", mode: :preserve
28
28
  end
29
29
 
@@ -66,7 +66,7 @@ EOB
66
66
  end
67
67
 
68
68
  def update_oscal_docs
69
- update_cicd_oscal_docs("CircleCI")
69
+ copy_oscal_component "circleci"
70
70
  end
71
71
 
72
72
  no_tasks do
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  #
3
- # this script is used by docker-compose and Dockerfile to start up a servrer
3
+ # this script is used by docker-compose and Dockerfile.ci to start up a server
4
4
  # for running OWASP in CircleCI
5
5
 
6
6
  dockerize -wait tcp://db:5432 -timeout 1m