rails_template_18f 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +49 -45
  4. data/README.md +102 -29
  5. data/exe/rails_template_18f +0 -21
  6. data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +2 -2
  7. data/lib/generators/rails_template18f/auditree/auditree_generator.rb +115 -0
  8. data/lib/generators/rails_template18f/auditree/templates/bin/auditree.tt +103 -0
  9. data/lib/generators/rails_template18f/auditree/templates/github/actions/auditree-cmd/action.yml.tt +42 -0
  10. data/lib/generators/rails_template18f/auditree/templates/github/workflows/auditree-validation.yml.tt +38 -0
  11. data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +8 -7
  12. data/lib/generators/rails_template18f/cloud_gov_config/cloud_gov_config_generator.rb +1 -1
  13. data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +0 -1
  14. data/lib/generators/rails_template18f/github_actions/templates/github/dependabot.yml.tt +25 -0
  15. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/assemble-ssp.yml.tt +12 -3
  16. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/brakeman-analysis.yml +1 -1
  17. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/rspec.yml.tt +9 -1
  18. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/{validate-ssp.yml.tt → validate-ssp.yml} +1 -1
  19. data/lib/generators/rails_template18f/newrelic/newrelic_generator.rb +1 -1
  20. data/lib/generators/rails_template18f/oscal/oscal_generator.rb +14 -1
  21. data/lib/generators/rails_template18f/oscal/templates/bin/trestle.tt +4 -1
  22. data/lib/generators/rails_template18f/oscal/templates/github/actions/trestle-cmd/action.yml.tt +16 -0
  23. data/lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb +1 -1
  24. data/lib/rails_template18f/version.rb +1 -1
  25. data/rails-template-18f.gemspec +3 -3
  26. data/railsrc +2 -0
  27. data/railsrc-hotwire +2 -0
  28. data/template.rb +26 -11
  29. data/templates/lib/tasks/scanning.rake +1 -1
  30. data/templates/manifest.yml.tt +0 -1
  31. metadata +16 -12
  32. data/lib/generators/rails_template18f/github_actions/templates/github/actions/trestle-cmd/action.yml +0 -20
  33. data/lib/rails_template18f/app_updater.rb +0 -19
@@ -0,0 +1,103 @@
1
+ #! /usr/bin/env bash
2
+
3
+ image="ghcr.io/gsa-tts/auditree"
4
+ tag="<%= docker_auditree_tag %>"
5
+ cwd=`pwd`
6
+ cdef="doc/compliance/oscal/component-definitions/devtools_cloud_gov/component-definition.json"
7
+ config="config/auditree.template.json"
8
+ email="<%= git_email %>"
9
+
10
+ usage="
11
+ $0: Run auditree docker image: $image.
12
+
13
+ Usage:
14
+ $0 -h
15
+ $0 [-a AUDITREE_CONFIG_TEMPLATE] [-c CDEF] [-v EXTRA_VOLUME] [-e GIT_EMAIL] [-t TAG] CMD
16
+ $0 [-a AUDITREE_CONFIG_TEMPLATE] init
17
+ $0 [-o] check
18
+
19
+ Options:
20
+ -h: show help and exit
21
+ -a: Auditree config. Given relative to \"$cwd\" Defaults to \"$config\". Location to write for init CMD
22
+ -c: component definition. Given relative to \"$cwd\" Defaults to \"$cdef\"
23
+ -v: volume to mount. Given as a docker -v argument except that the first part is relative to \"$cwd\"
24
+ -e: Git email. Defaults to \"$email\"
25
+ -t: Auditree docker tag. Defaults to \"$tag\"
26
+ -o: Write assessment results to \"$cwd/tmp/auditree/auditree.json\". Only applicable for \"check\"
27
+ CMD: The command to run. Defaults to \"bash\"
28
+
29
+ Notes:
30
+ The following environment variables will be passed through to the docker image:
31
+ * GITHUB_TOKEN - a token that has permissions to read and write to the evidence locker and code repository. Required for all but 'init'
32
+ * CF_USERNAME - the cloud.gov username to fetch evidence from cloud.gov, only needed when running fetch script
33
+ * CF_PASSWORD - the cloud.gov password to fetch evidence from cloud.gov, only needed when running fetch script
34
+ "
35
+
36
+ ar_output=""
37
+ args_to_shift=0
38
+ declare -a volume_args
39
+
40
+ while getopts "ha:c:v:e:t:o" opt; do
41
+ case "$opt" in
42
+ a)
43
+ config=${OPTARG}
44
+ args_to_shift=$((args_to_shift + 2))
45
+ ;;
46
+ c)
47
+ cdef=${OPTARG}
48
+ args_to_shift=$((args_to_shift + 2))
49
+ ;;
50
+ v)
51
+ volume_args+=("-v" "$cwd/${OPTARG}")
52
+ args_to_shift=$((args_to_shift + 2))
53
+ ;;
54
+ e)
55
+ email=${OPTARG}
56
+ args_to_shift=$((args_to_shift + 2))
57
+ ;;
58
+ t)
59
+ tag=${OPTARG}
60
+ args_to_shift=$((args_to_shift + 2))
61
+ ;;
62
+ o)
63
+ ar_output="$cwd/tmp/auditree"
64
+ args_to_shift=$((args_to_shift + 1))
65
+ ;;
66
+ h)
67
+ echo "$usage"
68
+ exit 0
69
+ ;;
70
+ esac
71
+ done
72
+
73
+ shift $args_to_shift
74
+
75
+ command="bash"
76
+ if [ "$1" != "" ]; then
77
+ command="$1"
78
+ shift 1
79
+ fi
80
+
81
+ if [ "$command" = "init" ]; then
82
+ docker run --rm $image:$tag init > "$config"
83
+ exit 0
84
+ fi
85
+
86
+ volume_args+=("-v" "$cwd/$config":/app/auditree.template.json:ro)
87
+ volume_args+=("-v" "$cwd/$cdef":/app/cdef.json:ro)
88
+ if [ "$ar_output" != "" ]; then
89
+ mkdir -p "$ar_output"
90
+ chmod a+w "$ar_output"
91
+ volume_args+=("-v" "$ar_output":/tmp/auditree:rw)
92
+ if [ "$command" = "check" ]; then
93
+ command="check /tmp/auditree"
94
+ fi
95
+ fi
96
+
97
+ if [ "$command" = "bash" ]; then
98
+ docker run -e GITHUB_TOKEN -e CF_USERNAME -e CF_PASSWORD -e GIT_EMAIL="$email" \
99
+ "${volume_args[@]}" -it --rm $image:$tag $command "$@"
100
+ else
101
+ docker run -e GITHUB_TOKEN -e CF_USERNAME -e CF_PASSWORD -e GIT_EMAIL="$email" \
102
+ "${volume_args[@]}" --rm $image:$tag $command "$@"
103
+ fi
@@ -0,0 +1,42 @@
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.
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: false
14
+ default: "<%= git_email %>"
15
+ config_template:
16
+ description: Auditree config file template
17
+ required: false
18
+ default: config/auditree.template.json
19
+ cdef:
20
+ description: OSCAL Component Definition being used as baseline for assessment results
21
+ required: false
22
+ default: doc/compliance/oscal/component-definitions/devtools_cloud_gov/component-definition.json
23
+ volume:
24
+ description: Freeform volume string to mount another file in the auditree image
25
+ required: false
26
+ default: ""
27
+ runs:
28
+ using: "composite"
29
+ steps:
30
+ - name: Run cmd
31
+ shell: bash
32
+ if: ${{ inputs.volume == '' }}
33
+ run:
34
+ bin/auditree -t ${{ inputs.tag }} -a ${{ inputs.config_template }} -c ${{ inputs.cdef }}
35
+ -e "${{ inputs.email }}" ${{ inputs.cmd }}
36
+
37
+ - name: Run cmd with volume
38
+ shell: bash
39
+ if: ${{ inputs.volume != '' }}
40
+ run:
41
+ bin/auditree -t ${{ inputs.tag }} -a ${{ inputs.config_template }} -c ${{ inputs.cdef }}
42
+ -e "${{ inputs.email }}" -v ${{ inputs.volume }} ${{ inputs.cmd }}
@@ -0,0 +1,38 @@
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
+
27
+ - name: Check evidence
28
+ uses: ./.github/actions/auditree-cmd
29
+ env:
30
+ GITHUB_TOKEN: ${{ secrets.AUDITREE_GITHUB_TOKEN }}
31
+ with:
32
+ cmd: -o check
33
+
34
+ - name: Save results
35
+ uses: actions/upload-artifact@v4
36
+ with:
37
+ name: auditree_assessment_results
38
+ path: tmp/auditree/auditree.json
@@ -20,19 +20,16 @@ commands:
20
20
  description: Set up environment for running docker-trestle commands
21
21
  parameters:
22
22
  tag:
23
- description: docker-trestle tag to use. Defaults to latest
23
+ description: docker-trestle tag to use.
24
24
  type: string
25
25
  default: latest
26
26
  cmd:
27
27
  description: Command to run within docker-trestle
28
28
  type: string
29
29
  steps:
30
- - run:
31
- name: Fix directory permissions
32
- command: chmod -R a+w doc/compliance/oscal || true
33
30
  - run:
34
31
  name: Run trestle command
35
- command: docker run -v $(pwd)/doc/compliance/oscal:/app/docs:rw ghcr.io/gsa-tts/trestle:<< parameters.tag >> << parameters.cmd >><% end %>
32
+ command: docker run -u "$(id -u):$(id -g)" -v $(pwd)/doc/compliance/oscal:/app/docs:rw ghcr.io/gsa-tts/trestle:<< parameters.tag >> << parameters.cmd >><% end %>
36
33
  cg-deploy:
37
34
  description: "Login to cloud foundry space with service account credentials
38
35
  and push application using deployment configuration file."
@@ -141,7 +138,7 @@ jobs:
141
138
  steps:
142
139
  - checkout
143
140
  - trestle-cmd:
144
- cmd: trestle validate -f system-security-plans/<%= app_name %>/system-security-plan.json
141
+ cmd: validate-ssp-json
145
142
  - trestle-cmd:
146
143
  cmd: assemble-ssp-json 2> /dev/null | grep "^No changes to assembled ssp"
147
144
  assemble_ssp:
@@ -151,8 +148,12 @@ jobs:
151
148
  - checkout
152
149
  - trestle-cmd:
153
150
  cmd: trestle assemble -n <%= app_name %> system-security-plan
151
+ - trestle-cmd:
152
+ cmd: render-ssp
154
153
  - store_artifacts:
155
154
  path: doc/compliance/oscal/dist/system-security-plans/<%= app_name %>.json
155
+ - store_artifacts:
156
+ path: doc/compliance/oscal/ssp-render/<%= app_name %>_ssp.md
156
157
  <% end %>
157
158
  static_security_scans:
158
159
  docker:
@@ -161,7 +162,7 @@ jobs:
161
162
  - setup-project
162
163
  - run:
163
164
  name: Run Brakeman scan
164
- command: bundle exec brakeman
165
+ command: bin/brakeman --no-pager --ensure-ignore-notes
165
166
  - run:
166
167
  name: Bundle audit
167
168
  command: bundle exec rake bundler:audit
@@ -15,7 +15,7 @@ module RailsTemplate18f
15
15
  def install_climate_control
16
16
  return if gem_installed?("climate_control")
17
17
  gem_group :test do
18
- gem "climate_control", "~> 1.0"
18
+ gem "climate_control", "~> 1.2"
19
19
  end
20
20
  bundle_install
21
21
  end
@@ -24,7 +24,6 @@ module RailsTemplate18f
24
24
  if !oscal_dir_exists?
25
25
  remove_file ".github/workflows/validate-ssp.yml"
26
26
  remove_file ".github/workflows/assemble-ssp.yml"
27
- remove_dir ".github/actions/trestle-cmd"
28
27
  end
29
28
  end
30
29
 
@@ -0,0 +1,25 @@
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: npm
9
+ directory: "/"
10
+ schedule:
11
+ interval: daily
12
+ open-pull-requests-limit: 10
13
+ - package-ecosystem: github-actions
14
+ directory: "/"
15
+ schedule:
16
+ interval: daily
17
+ open-pull-requests-limit: 10<% if terraform? %>
18
+ - package-ecosystem: terraform
19
+ directories:
20
+ - "/terraform/production"
21
+ - "/terraform/staging"
22
+ schedule:
23
+ interval: weekly
24
+ open-pull-requests-limit: 10
25
+ <% end %>
@@ -4,8 +4,6 @@ on:
4
4
  workflow_dispatch:
5
5
  push:
6
6
  branches: [ main ]
7
- paths:
8
- - "doc/compliance/oscal/**"
9
7
 
10
8
  jobs:
11
9
  assemble_ssp:
@@ -19,8 +17,19 @@ jobs:
19
17
  with:
20
18
  cmd: trestle assemble -n <%= app_name %> system-security-plan
21
19
 
20
+ - name: Render final SSPP
21
+ uses: ./.github/actions/trestle-cmd
22
+ with:
23
+ cmd: render-ssp
24
+
25
+ - name: Transform SSPP to PDF
26
+ run: docker run --rm -u "$(id -u):$(id -g)" -v "$GITHUB_WORKSPACE/doc/compliance/oscal/ssp-render:/data" pandoc/latex <%= app_name %>_ssp.md -o <%= app_name %>_ssp.pdf
27
+
22
28
  - name: Save artifact
23
29
  uses: actions/upload-artifact@v4
24
30
  with:
25
31
  name: <%= app_name %>_SSPP
26
- path: doc/compliance/oscal/dist/system-security-plans/<%= app_name %>.json
32
+ path: |
33
+ doc/compliance/oscal/dist/system-security-plans/<%= app_name %>.json
34
+ doc/compliance/oscal/ssp-render/<%= app_name %>_ssp.md
35
+ doc/compliance/oscal/ssp-render/<%= app_name %>_ssp.pdf
@@ -39,7 +39,7 @@ jobs:
39
39
  - name: Scan
40
40
  continue-on-error: true
41
41
  run: |
42
- bundle exec brakeman -f sarif -o output.sarif.json .
42
+ bin/brakeman --no-pager --ensure-ignore-notes -f sarif -o output.sarif.json
43
43
 
44
44
  # Upload the SARIF file generated in the previous step
45
45
  - name: Upload SARIF
@@ -30,5 +30,13 @@ jobs:
30
30
 
31
31
  - name: Run rspec
32
32
  env:
33
- DATABASE_URL: ${{ steps.setup.outputs.database_url }}
33
+ DATABASE_URL: ${{ steps.setup.outputs.database_url }}<% if oscal_dir_exists? %>
34
+ rspec_oscal_output: tmp<% end %>
34
35
  run: bundle exec rspec
36
+ <% if oscal_dir_exists? %>
37
+ - name: Save assessment results
38
+ uses: actions/upload-artifact@v4
39
+ with:
40
+ name: <%= app_name %>_assessment
41
+ path: tmp/oscal
42
+ <% end %>
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Validate SSP
17
17
  uses: ./.github/actions/trestle-cmd
18
18
  with:
19
- cmd: trestle validate -f system-security-plans/<%= app_name %>/system-security-plan.json
19
+ cmd: validate-ssp-json
20
20
 
21
21
  check_ssp:
22
22
  name: Check assembly is current
@@ -24,7 +24,7 @@ module RailsTemplate18f
24
24
 
25
25
  def install_gem
26
26
  return if gem_installed?("newrelic_rpm")
27
- gem "newrelic_rpm", "~> 9.10"
27
+ gem "newrelic_rpm", "~> 9.12"
28
28
  bundle_install
29
29
  end
30
30
 
@@ -10,6 +10,7 @@ module RailsTemplate18f
10
10
  class_option :oscal_repo, desc: "GitHub Repo to store compliance documents within. Leave blank to check docs into the app repo"
11
11
  class_option :tag, desc: "Which docker-trestle tag to use. Defaults to `latest`"
12
12
  class_option :branch, desc: "Name of the branch to switch to when using a submodule. Defaults to `main`"
13
+ class_option :ci, desc: "Name of CI to generate files for. Defaults to system already in use"
13
14
 
14
15
  desc <<~DESC
15
16
  Description:
@@ -42,6 +43,12 @@ module RailsTemplate18f
42
43
  template "doc/compliance/oscal/trestle-config.yaml"
43
44
  end
44
45
 
46
+ def copy_github_actions
47
+ if use_github_actions?
48
+ directory "github", ".github"
49
+ end
50
+ end
51
+
45
52
  def update_readme
46
53
  if file_content("README.md").match?("## Documentation")
47
54
  insert_into_file "README.md", readme_contents, after: "## Documentation\n"
@@ -66,6 +73,8 @@ module RailsTemplate18f
66
73
  # Trestle working files
67
74
  doc/compliance/oscal/.trestle/_trash
68
75
  doc/compliance/oscal/.trestle/cache
76
+ # Trestle renders
77
+ doc/compliance/oscal/ssp-render/#{app_name}_ssp.*
69
78
  EOM
70
79
  end
71
80
  end
@@ -76,7 +85,11 @@ module RailsTemplate18f
76
85
  end
77
86
 
78
87
  def docker_trestle_tag
79
- options[:tag].present? ? options[:tag] : "latest"
88
+ options[:tag].present? ? options[:tag] : "20240912"
89
+ end
90
+
91
+ def use_github_actions?
92
+ options[:ci] == "github" || file_exists?(".github/workflows")
80
93
  end
81
94
 
82
95
  def readme_contents
@@ -1,10 +1,13 @@
1
1
  #! /usr/bin/env bash
2
2
 
3
+ trestle_tag="<%= docker_trestle_tag %>"
4
+
3
5
  command="bash"
4
6
  if [ "$1" != "" ]; then
5
7
  command=$1
8
+ shift 1
6
9
  fi
7
10
 
8
11
  oscal_location="$(dirname "$(realpath "$0")")/../doc/compliance/oscal"
9
12
 
10
- docker run -it --rm -v $oscal_location:/app/docs:rw ghcr.io/gsa-tts/trestle:<%= docker_trestle_tag %> $command
13
+ docker run -it --rm -v $oscal_location:/app/docs:rw ghcr.io/gsa-tts/trestle:$trestle_tag $command "$@"
@@ -0,0 +1,16 @@
1
+ name: "Run a docker-trestle command"
2
+ description: "Sets up workspace for running a single command in docker-trestle"
3
+ inputs:
4
+ tag:
5
+ description: docker-trestle tag to use.
6
+ required: false
7
+ default: <%= docker_trestle_tag %>
8
+ cmd:
9
+ description: Command to run within docker-trestle
10
+ required: true
11
+ runs:
12
+ using: "composite"
13
+ steps:
14
+ - name: Run cmd
15
+ shell: bash
16
+ run: docker run -u "$(id -u):$(id -g)" -v $GITHUB_WORKSPACE/doc/compliance/oscal:/app/docs:rw ghcr.io/gsa-tts/trestle:${{ inputs.tag }} ${{ inputs.cmd }}
@@ -14,7 +14,7 @@ module RailsTemplate18f
14
14
 
15
15
  def install_gem
16
16
  return if gem_installed?("sidekiq")
17
- gem "sidekiq", "~> 7.2"
17
+ gem "sidekiq", "~> 7.3"
18
18
  bundle_install
19
19
  end
20
20
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsTemplate18f
4
- VERSION = "1.0.0"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -31,12 +31,12 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  # For more information and examples about making a new gem, checkout our
33
33
  # guide at: https://bundler.io/guides/creating_gem.html
34
- spec.add_dependency "railties", "~> 7.1.0"
35
- spec.add_dependency "activesupport", "~> 7.1.0"
34
+ spec.add_dependency "railties", "~> 7.2.0"
35
+ spec.add_dependency "activesupport", "~> 7.2.0"
36
36
  spec.add_dependency "thor", "~> 1.3"
37
37
  spec.add_dependency "colorize", "~> 1.1"
38
38
 
39
39
  spec.add_development_dependency "rspec", "~> 3.13"
40
40
  spec.add_development_dependency "ammeter", "~> 1.1"
41
- spec.add_development_dependency "standard", "~> 1.36"
41
+ spec.add_development_dependency "standard", "~> 1.40"
42
42
  end
data/railsrc CHANGED
@@ -9,3 +9,5 @@
9
9
  --css=postcss
10
10
  --template=template.rb
11
11
  --database=postgresql
12
+ --skip-rubocop
13
+ --skip-ci
data/railsrc-hotwire CHANGED
@@ -7,3 +7,5 @@
7
7
  --css=postcss
8
8
  --template=template.rb
9
9
  --database=postgresql
10
+ --skip-rubocop
11
+ --skip-ci
data/template.rb CHANGED
@@ -39,14 +39,16 @@ def print_announcements
39
39
  end
40
40
  end
41
41
 
42
- unless Gem::Dependency.new("rails", "~> 7.1.0").match?("rails", Rails.gem_version)
43
- warn "This template requires Rails 7.1.x"
42
+ unless Gem::Dependency.new("rails", "~> 7.2.0").match?("rails", Rails.gem_version)
43
+ warn "This template requires Rails 7.2.x"
44
44
  if Gem::Dependency.new("rails", "~> 6.1.0").match?("rails", Rails.gem_version)
45
45
  warn "See the rails-6 branch https://github.com/gsa-tts/rails-template/tree/rails-6"
46
46
  elsif Gem::Dependency.new("rails", "~> 7.0.0").match?("rails", Rails.gem_version)
47
47
  warn "See the rails-7.0 branch https://github.com/gsa-tts/rails-template/tree/rails-7.0"
48
- elsif Gem::Dependency.new("rails", "~> 7.2.0").match?("rails", Rails.gem_version)
49
- warn "We haven't updated the template for Rails 7.2 yet! Please file an issue so we can get the template updated"
48
+ elsif Gem::Dependency.new("rails", "~> 7.1.0").match?("rails", Rails.gem_version)
49
+ warn "See the rails-7.1 branch https://github.com/gsa-tts/rails-template/tree/rails-7.1"
50
+ elsif Gem::Dependency.new("rails", ">= 7.3.0").match?("rails", Rails.gem_version)
51
+ warn "We haven't updated the template for Rails >= 7.3 yet! Please file an issue so we can get the template updated"
50
52
  else
51
53
  warn "We didn't recognize the version of Rails you are using: #{Rails.version}"
52
54
  end
@@ -69,6 +71,11 @@ if compliance_trestle_submodule && compliance_trestle_repo.blank?
69
71
  compliance_trestle = false
70
72
  compliance_trestle_submodule = false
71
73
  end
74
+ # only ask about auditree if we're also using docker-trestle
75
+ auditree = compliance_trestle ? yes?("Run compliance checks with auditree? (y/n)") : false
76
+ if auditree
77
+ auditree_evidence_repo = ask("What is the https address of your auditree evidence repo? (Leave blank to fill in later)")
78
+ end
72
79
 
73
80
  terraform = yes?("Create terraform files for cloud.gov services? (y/n)")
74
81
  @cloud_gov_organization = ask("What is your cloud.gov organization name? (Leave blank to fill in later)")
@@ -109,9 +116,8 @@ EOM
109
116
  if compliance_trestle
110
117
  after_bundle do
111
118
  generator_arguments = []
112
- if compliance_trestle_submodule
113
- generator_arguments << "--oscal_repo=#{compliance_trestle_repo}"
114
- end
119
+ generator_arguments << "--oscal_repo=#{compliance_trestle_repo}" if compliance_trestle_submodule
120
+ generator_arguments << "--ci=github" if @github_actions
115
121
  generate "rails_template18f:oscal", *generator_arguments
116
122
  end
117
123
  register_announcement("OSCAL Documentation", <<~EOM)
@@ -181,7 +187,7 @@ after_bundle do
181
187
  end
182
188
 
183
189
  # updates for OWASP scan to pass
184
- gem "secure_headers", "~> 6.3"
190
+ gem "secure_headers", "~> 6.7"
185
191
  initializer "secure_headers.rb", <<~EOM
186
192
  SecureHeaders::Configuration.default do |config|
187
193
  # CSP settings are handled by Rails
@@ -222,9 +228,8 @@ uncomment_lines csp_initializer, "content_security_policy_nonce"
222
228
  gem_group :development, :test do
223
229
  gem "rspec-rails", "~> 6.1"
224
230
  gem "dotenv-rails", "~> 3.1"
225
- gem "brakeman", "~> 6.1"
226
231
  gem "bundler-audit", "~> 0.9"
227
- gem "standard", "~> 1.36"
232
+ gem "standard", "~> 1.40"
228
233
  end
229
234
  if ENV["RT_DEV"] == "true"
230
235
  gem "rails_template_18f", group: :development, path: ENV["PWD"]
@@ -458,6 +463,15 @@ if @circleci_pipeline
458
463
  EOM
459
464
  end
460
465
 
466
+ if auditree
467
+ after_bundle do
468
+ generate "rails_template18f:auditree", "--evidence_locker=#{auditree_evidence_repo}"
469
+ end
470
+ register_announcement "Auditree", <<~EOM
471
+ * Don't forget to follow the initial setup instructions for Auditree in the main README
472
+ EOM
473
+ end
474
+
461
475
  # setup production credentials file
462
476
  require "rails/generators"
463
477
  require "rails/generators/rails/encryption_key_file/encryption_key_file_generator"
@@ -487,7 +501,8 @@ EOM
487
501
  # ensure this is the very last step
488
502
  after_bundle do
489
503
  if run_db_setup
490
- rails_command "db:setup"
504
+ rails_command "db:create"
505
+ rails_command "db:migrate"
491
506
  end
492
507
 
493
508
  # x86_64-linux is required to install gems on any linux system such as cloud.gov or CI pipelines
@@ -2,7 +2,7 @@ desc "Run brakeman with potential non-0 return code"
2
2
  task :brakeman do
3
3
  # -z flag makes it return non-0 if there are any warnings
4
4
  # -q quiets output
5
- unless system("brakeman -z -q") # system is true if return is 0, false otherwise
5
+ unless system("bin/brakeman -z -q") # system is true if return is 0, false otherwise
6
6
  abort("Brakeman detected one or more code problems, please run it manually and inspect the output.")
7
7
  end
8
8
  end
@@ -2,7 +2,6 @@
2
2
  applications:
3
3
  - name: <%= app_name %>-((env))
4
4
  buildpacks:
5
- - nodejs_buildpack
6
5
  - ruby_buildpack
7
6
  env:
8
7
  RAILS_MASTER_KEY: ((rails_master_key))