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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +58 -28
- data/README.md +5 -5
- data/Rakefile +12 -0
- data/SECURITY.md +18 -0
- data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +2 -9
- data/lib/generators/rails_template18f/active_storage/templates/oscal/component-definitions/active_storage/component-definition.json +69 -0
- data/lib/generators/rails_template18f/auditree/auditree_generator.rb +84 -0
- data/lib/generators/rails_template18f/auditree/templates/bin/auditree.tt +29 -0
- data/lib/generators/rails_template18f/auditree/templates/github/actions/auditree-cmd/action.yml.tt +31 -0
- data/lib/generators/rails_template18f/auditree/templates/github/workflows/auditree-validation.yml.tt +42 -0
- data/lib/generators/rails_template18f/circleci/circleci_generator.rb +3 -3
- data/lib/generators/rails_template18f/circleci/templates/bin/ci-server-start +1 -1
- data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +59 -16
- data/lib/generators/rails_template18f/circleci/templates/docker-compose.ci.yml +1 -0
- data/lib/generators/rails_template18f/circleci/templates/oscal/component-definitions/circleci/component-definition.json.tt +310 -0
- data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +7 -12
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-languages/action.yml.tt +1 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt +1 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/trestle-cmd/action.yml +20 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/assemble-ssp.yml.tt +26 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/brakeman-analysis.yml +6 -2
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml +4 -4
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +14 -25
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +14 -25
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt +8 -3
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt +4 -3
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt +6 -2
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/rspec.yml.tt +1 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +20 -58
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +20 -58
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/validate-ssp.yml.tt +46 -0
- data/lib/generators/rails_template18f/github_actions/templates/oscal/component-definitions/github_actions/component-definition.json.tt +310 -0
- data/lib/generators/rails_template18f/i18n/i18n_generator.rb +7 -6
- data/lib/generators/rails_template18f/i18n/templates/config/locales/en.yml.tt +1 -0
- data/lib/generators/rails_template18f/i18n/templates/config/locales/es.yml +2 -0
- data/lib/generators/rails_template18f/i18n/templates/config/locales/fr.yml +2 -0
- data/lib/generators/rails_template18f/i18n/templates/config/locales/zh.yml +2 -0
- data/lib/generators/rails_template18f/newrelic/newrelic_generator.rb +2 -37
- data/lib/generators/rails_template18f/newrelic/templates/oscal/component-definitions/newrelic/component-definition.json.tt +113 -0
- data/lib/generators/rails_template18f/oscal/oscal_generator.rb +55 -17
- data/lib/generators/rails_template18f/oscal/templates/bin/trestle.tt +10 -0
- data/lib/generators/rails_template18f/oscal/templates/doc/compliance/oscal/trestle-config.yaml.tt +6 -0
- data/lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb +2 -2
- data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +1 -1
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +4 -4
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt +0 -1
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +4 -4
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf.tt +0 -1
- data/lib/rails_template18f/generators/base.rb +9 -24
- data/lib/rails_template18f/generators/pipeline_options.rb +0 -172
- data/lib/rails_template18f/version.rb +1 -1
- data/rails-template-18f.gemspec +6 -6
- data/railsrc +1 -0
- data/railsrc-hotwire +1 -0
- data/template.rb +56 -44
- data/templates/Brewfile +2 -2
- data/templates/README.md.tt +3 -4
- data/templates/app/assets/stylesheets/uswds-components.scss +6 -0
- data/templates/app/assets/stylesheets/uswds-overrides/_index.scss +2 -0
- data/templates/app/assets/stylesheets/uswds-overrides/_override-usa-banner.scss +13 -0
- data/templates/app/assets/stylesheets/uswds-overrides/_override-usa-language-selector.scss +38 -0
- data/templates/app/views/application/_header.html.erb +6 -5
- data/templates/app/views/application/_language_selector.html.erb +35 -0
- data/templates/app/views/application/_usa_banner.html.erb +21 -16
- data/templates/bin/owasp-scan +3 -3
- data/templates/bin/pa11y-scan +1 -1
- data/templates/config/environments/ci.rb +1 -0
- data/templates/manifest.yml.tt +0 -1
- data/templates/pa11y.js +12 -0
- data/templates/pa11yci.js +8 -0
- metadata +35 -16
- data/templates/pa11yci +0 -9
- /data/lib/generators/rails_template18f/circleci/templates/{Dockerfile.tt → Dockerfile.ci.tt} +0 -0
@@ -7,35 +7,41 @@ module RailsTemplate18f
|
|
7
7
|
class OscalGenerator < ::Rails::Generators::Base
|
8
8
|
include Base
|
9
9
|
|
10
|
-
class_option :oscal_repo,
|
11
|
-
class_option :
|
12
|
-
class_option :branch, desc: "Name of the branch to switch to when using a submodule. Defaults to `
|
10
|
+
class_option :oscal_repo, desc: "GitHub Repo to store compliance documents within. Leave blank to check docs into the app repo"
|
11
|
+
class_option :tag, desc: "Which docker-trestle tag to use. Defaults to `latest`"
|
12
|
+
class_option :branch, desc: "Name of the branch to switch to when using a submodule. Defaults to `main`"
|
13
13
|
|
14
14
|
desc <<~DESC
|
15
15
|
Description:
|
16
|
-
|
17
|
-
submodule for documenting security controls.
|
16
|
+
Set up doc/compliance/oscal as a working directory for use with https://github.com/GSA-TTS/docker-trestle.
|
18
17
|
|
19
18
|
This generator is still experimental.
|
20
19
|
|
21
|
-
Prerequisite:
|
20
|
+
Optional Prerequisite:
|
22
21
|
|
23
|
-
|
22
|
+
Set up a separate private repository to store the compliance documentation in if access control needs to be
|
23
|
+
tighter than for the code. This generator will set up the directory as a submodule so developers with access
|
24
|
+
can easily update documentation alongside code. Updates to the documentation
|
24
25
|
will be pushed to this fork, not the rails app repository.
|
25
26
|
DESC
|
26
27
|
|
27
|
-
def
|
28
|
-
if
|
29
|
-
git clone: "#{options[:oscal_repo]} doc/compliance/oscal"
|
30
|
-
remove_dir "doc/compliance/oscal/.git"
|
31
|
-
else
|
28
|
+
def configure_compliance_files
|
29
|
+
if use_submodule?
|
32
30
|
git submodule: "add #{options[:oscal_repo]} doc/compliance/oscal"
|
33
31
|
inside "doc/compliance/oscal" do
|
34
32
|
git switch: "-c #{branch_name}"
|
35
33
|
end
|
34
|
+
else
|
35
|
+
create_file "doc/compliance/oscal/.keep"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def copy_templates
|
40
|
+
template "bin/trestle"
|
41
|
+
chmod "bin/trestle", 0o755
|
42
|
+
template "doc/compliance/oscal/trestle-config.yaml"
|
43
|
+
end
|
44
|
+
|
39
45
|
def update_readme
|
40
46
|
if file_content("README.md").match?("## Documentation")
|
41
47
|
insert_into_file "README.md", readme_contents, after: "## Documentation\n"
|
@@ -45,7 +51,7 @@ module RailsTemplate18f
|
|
45
51
|
end
|
46
52
|
|
47
53
|
def configure_submodule
|
48
|
-
|
54
|
+
if use_submodule?
|
49
55
|
git config: "-f .gitmodules submodule.\"doc/compliance/oscal\".branch #{branch_name}"
|
50
56
|
git config: "diff.submodule log"
|
51
57
|
git config: "status.submodulesummary 1"
|
@@ -53,9 +59,24 @@ module RailsTemplate18f
|
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
62
|
+
def configure_gitignore
|
63
|
+
unless skip_git? || use_submodule?
|
64
|
+
append_to_file ".gitignore", <<~EOM
|
65
|
+
|
66
|
+
# Trestle working files
|
67
|
+
doc/compliance/oscal/.trestle/_trash
|
68
|
+
doc/compliance/oscal/.trestle/cache
|
69
|
+
EOM
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
56
73
|
no_tasks do
|
57
74
|
def branch_name
|
58
|
-
options[:branch].present? ? options[:branch] :
|
75
|
+
options[:branch].present? ? options[:branch] : "main"
|
76
|
+
end
|
77
|
+
|
78
|
+
def docker_trestle_tag
|
79
|
+
options[:tag].present? ? options[:tag] : "latest"
|
59
80
|
end
|
60
81
|
|
61
82
|
def readme_contents
|
@@ -64,8 +85,25 @@ module RailsTemplate18f
|
|
64
85
|
### Compliance Documentation
|
65
86
|
|
66
87
|
Security Controls should be documented within doc/compliance/oscal.
|
88
|
+
|
89
|
+
* Run `bin/trestle` to start the trestle CLI.
|
90
|
+
* Run `bin/trestle SCRIPT_NAME` to run a single trestle script
|
91
|
+
|
92
|
+
#### Initial trestle setup.
|
93
|
+
|
94
|
+
These steps must happen once per project.
|
95
|
+
|
96
|
+
1. Docker desktop must be running
|
97
|
+
1. Start the trestle cli with `bin/trestle`
|
98
|
+
1. Copy the `cloud_gov` component to the local workspace with `copy-component -n cloud_gov`
|
99
|
+
1. Generate the initial markdown with `generate-ssp-markdown`
|
100
|
+
|
101
|
+
#### Ongoing use
|
102
|
+
|
103
|
+
See the [docker-trestle README](https://github.com/gsa-tts/docker-trestle) for help with the workflow
|
104
|
+
for using those scripts for editing the SSP.
|
67
105
|
README
|
68
|
-
return content
|
106
|
+
return content unless use_submodule?
|
69
107
|
<<~README
|
70
108
|
#{content}
|
71
109
|
|
@@ -94,8 +132,8 @@ module RailsTemplate18f
|
|
94
132
|
README
|
95
133
|
end
|
96
134
|
|
97
|
-
def
|
98
|
-
options[:
|
135
|
+
def use_submodule?
|
136
|
+
options[:oscal_repo].present?
|
99
137
|
end
|
100
138
|
end
|
101
139
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#! /usr/bin/env bash
|
2
|
+
|
3
|
+
command="bash"
|
4
|
+
if [ "$1" != "" ]; then
|
5
|
+
command=$1
|
6
|
+
fi
|
7
|
+
|
8
|
+
oscal_location="$(dirname "$(realpath "$0")")/../doc/compliance/oscal"
|
9
|
+
|
10
|
+
docker run -it --rm -v $oscal_location:/app/docs:rw ghcr.io/gsa-tts/trestle:<%= docker_trestle_tag %> $command
|
@@ -14,7 +14,7 @@ module RailsTemplate18f
|
|
14
14
|
|
15
15
|
def install_gem
|
16
16
|
return if gem_installed?("sidekiq")
|
17
|
-
gem "sidekiq", "~>
|
17
|
+
gem "sidekiq", "~> 7.2"
|
18
18
|
bundle_install
|
19
19
|
end
|
20
20
|
|
@@ -24,7 +24,7 @@ module RailsTemplate18f
|
|
24
24
|
# queue for sidekiq jobs
|
25
25
|
brew "redis"
|
26
26
|
EOB
|
27
|
-
insert_into_file "README.md", indent("* [redis]()\n"), after: /\* Install homebrew dependencies: `brew bundle`\n/
|
27
|
+
insert_into_file "README.md", indent("* [redis](https://redis.io/)\n"), after: /\* Install homebrew dependencies: `brew bundle`\n/
|
28
28
|
end
|
29
29
|
|
30
30
|
def configure_server_runner
|
@@ -89,7 +89,7 @@ The below steps rely on you first configuring access to the Terraform state in s
|
|
89
89
|
|
90
90
|
1. Run terraform from your new environment directory with
|
91
91
|
```bash
|
92
|
-
terraform init
|
92
|
+
terraform init -backend-config="profile=<%= app_name %>-terraform-backend"
|
93
93
|
terraform plan
|
94
94
|
```
|
95
95
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
locals {
|
2
|
-
cf_org_name
|
3
|
-
cf_space_name
|
4
|
-
env
|
5
|
-
app_name
|
2
|
+
cf_org_name = "<%= cloud_gov_organization %>"
|
3
|
+
cf_space_name = "<%= cloud_gov_production_space %>"
|
4
|
+
env = "production"
|
5
|
+
app_name = "<%= app_name %>"
|
6
6
|
}
|
7
7
|
|
8
8
|
module "database" {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
locals {
|
2
|
-
cf_org_name
|
3
|
-
cf_space_name
|
4
|
-
env
|
5
|
-
app_name
|
2
|
+
cf_org_name = "<%= cloud_gov_organization %>"
|
3
|
+
cf_space_name = "<%= cloud_gov_staging_space %>"
|
4
|
+
env = "staging"
|
5
|
+
app_name = "<%= app_name %>"
|
6
6
|
}
|
7
7
|
|
8
8
|
module "database" {
|
@@ -18,7 +18,6 @@ module RailsTemplate18f
|
|
18
18
|
|
19
19
|
included do
|
20
20
|
self.source_path = RailsTemplate18f::Generators.const_source_location(name).first
|
21
|
-
class_option :oscal_profile, desc: "Name of the OSCAL profile to populate. Only needed if multiple folders are present in doc/compliance/oscal/dist/system-security-plans"
|
22
21
|
end
|
23
22
|
|
24
23
|
private
|
@@ -60,33 +59,19 @@ module RailsTemplate18f
|
|
60
59
|
Dir.exist? file_path("doc/compliance/oscal")
|
61
60
|
end
|
62
61
|
|
63
|
-
def
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#{content}
|
69
|
-
EOS
|
70
|
-
begin
|
71
|
-
insert_into_file File.join(oscal_path, filename), content, after: after
|
72
|
-
rescue Thor::Error => ex
|
73
|
-
warn ex.message
|
62
|
+
def copy_oscal_component(component_name)
|
63
|
+
template "oscal/component-definitions/#{component_name}/component-definition.json",
|
64
|
+
File.join(oscal_component_path, component_name, "component-definition.json")
|
65
|
+
if oscal_dir_exists?
|
66
|
+
insert_into_file "doc/compliance/oscal/trestle-config.yaml", " - #{component_name}\n"
|
74
67
|
end
|
75
68
|
end
|
76
69
|
|
77
|
-
def
|
78
|
-
|
79
|
-
file_path(
|
70
|
+
def oscal_component_path
|
71
|
+
if oscal_dir_exists?
|
72
|
+
file_path("doc/compliance/oscal/component-definitions")
|
80
73
|
else
|
81
|
-
|
82
|
-
profiles = Dir.children(ssp_dir).select { |f| File.directory?(File.join(ssp_dir, f)) }
|
83
|
-
if profiles.empty?
|
84
|
-
fail "No OSCAL profiles found. Please run `make generate` from the `doc/compliance/oscal` folder"
|
85
|
-
elsif profiles.count > 1
|
86
|
-
fail "Multiple OSCAL profiles found. Please specify which one to update by passing the `--oscal-profile` option"
|
87
|
-
else
|
88
|
-
File.join(ssp_dir, profiles.first)
|
89
|
-
end
|
74
|
+
file_path("doc/compliance/oscal-component-definitions")
|
90
75
|
end
|
91
76
|
end
|
92
77
|
|
@@ -13,178 +13,6 @@ module RailsTemplate18f
|
|
13
13
|
def terraform?
|
14
14
|
options[:terraform].nil? ? terraform_dir_exists? : options[:terraform]
|
15
15
|
end
|
16
|
-
|
17
|
-
def update_cicd_oscal_docs(ci_name)
|
18
|
-
if oscal_dir_exists?
|
19
|
-
update_ca7_oscal_doc
|
20
|
-
update_cm2_oscal_doc(ci_name)
|
21
|
-
update_cm3_oscal_doc(ci_name)
|
22
|
-
update_ra5_oscal_doc
|
23
|
-
update_sa11_oscal_doc(ci_name)
|
24
|
-
update_sa22_oscal_doc
|
25
|
-
update_sc281_oscal_doc(ci_name)
|
26
|
-
update_si2_oscal_doc
|
27
|
-
update_si10_oscal_doc
|
28
|
-
update_sr3_oscal_doc(ci_name)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def update_ca7_oscal_doc
|
35
|
-
insert_into_oscal "ca-7.md", <<~EOS, after: "## Implementation a.\n"
|
36
|
-
* #{app_name} DevOps staff review OWASP and Dependency scans every build, or at least weekly.
|
37
|
-
* #{app_name} DevOps staff and the GSA ISSO review Web Application vulnerability scans on a weekly basis.
|
38
|
-
* #{app_name} Administrators and DevOps staff review changes for potential security impact and engage the #{app_name} ISSO and ISSM who will review or engage assessment staff as needed.
|
39
|
-
EOS
|
40
|
-
end
|
41
|
-
|
42
|
-
def update_cm2_oscal_doc(ci)
|
43
|
-
insert_into_oscal "cm-2.2.md", <<~EOS
|
44
|
-
The #{app_name} team develops, documents, and maintains a current baseline for the #{app_name} application
|
45
|
-
components under configuration control, managed via git and github.com, and orchestrated using #{ci}
|
46
|
-
and the cloud.gov Cloud Foundry CLI.
|
47
|
-
|
48
|
-
Note: All cloud.gov brokered services (including databases) are fully managed by the cloud.gov platform.
|
49
|
-
Due to this, the configuration and security of these services are not included in the #{app_name} configuration baseline.
|
50
|
-
EOS
|
51
|
-
end
|
52
|
-
|
53
|
-
def update_cm3_oscal_doc(ci)
|
54
|
-
insert_into_oscal "cm-3.1.md", <<~EOS, after: "## Implementation (f)\n"
|
55
|
-
#{app_name} employs #{ci} to execute proposed changes to the information system.
|
56
|
-
#{app_name} Administrators and #{app_name} Developers are automatically notified of
|
57
|
-
the success or failure of the change execution via the GitHub notification system.
|
58
|
-
EOS
|
59
|
-
end
|
60
|
-
|
61
|
-
def update_ra5_oscal_doc
|
62
|
-
insert_into_oscal "ra-5.md", <<~EOS, after: "## Implementation a.\n"
|
63
|
-
Any vulnerabilities in #{app_name} would have to be introduced at time of deployment because #{app_name}
|
64
|
-
is a set of cloud.gov managed applications with SSH disabled in Production. #{app_name} monitors for
|
65
|
-
vulnerabilities by ensuring that scans for vulnerabilities in the information system and hosted applications occur
|
66
|
-
daily and when new code is deployed.
|
67
|
-
|
68
|
-
OWASP ZAP scans are built into the #{app_name} CI/CD pipeline and runs a series of web vulnerability scans before
|
69
|
-
a successful deploy can be made to cloud.gov. Any issues or alerts caused by the scan are documented by #{app_name}
|
70
|
-
Operations and cause the deployment to fail. Issues are tracked in GitHub. The issue posted will provide information
|
71
|
-
on which endpoints are vulnerable and the level of vulnerability, ranging from **False Positive** to **High**.
|
72
|
-
The issue also provides a detailed report formatted in html, json, and markdown.
|
73
|
-
|
74
|
-
#{app_name} Administrators are responsible for reporting any new vulnerabilities reported by the OWASP ZAP scan to the #{app_name} ISSO.
|
75
|
-
EOS
|
76
|
-
insert_into_oscal "ra-5.md", <<~EOS, after: "## Implementation b.\n"
|
77
|
-
1. Alerts from each ZAP vulnerability scan are automatically reported in GitHub as an issue on the #{app_name} repository.
|
78
|
-
This issue will enumerate each finding and detail the type and severity of the vulnerability. #{app_name} Developers and
|
79
|
-
#{app_name} Administrators receive automated alerts via GitHub of the issues to remediate. Scan results are sent to the
|
80
|
-
#{app_name} System Owner by #{app_name} Administrators. The vulnerabilities are analyzed and prioritized within GitHub
|
81
|
-
based on input from the #{app_name} System Owner and ISSO.
|
82
|
-
1. The ZAP report contains vulnerabilities grouped by type and by risk level. The report also provides a detailed report
|
83
|
-
formatted in html, json, and markdown. The reported issues also include the CVE item associated with the vulnerability.
|
84
|
-
1. Vulnerabilities are classified by ZAP under a level range from **False Positive** to **High**. The impact level is
|
85
|
-
used to drive the priority of the effort to remediate.
|
86
|
-
EOS
|
87
|
-
insert_into_oscal "ra-5.md", <<~EOS, after: "## Implementation c.\n"
|
88
|
-
The ZAP vulnerability report contains information about how the attack was made and suggested solutions for each vulnerability found.
|
89
|
-
Any static code analysis findings identified during automation as part of the GitHub pull request process must be reviewed, analyzed,
|
90
|
-
and resolved by the #{app_name} Developer before the team can merge the pull request.
|
91
|
-
EOS
|
92
|
-
end
|
93
|
-
|
94
|
-
def update_sa11_oscal_doc(ci)
|
95
|
-
insert_into_oscal "sa-11.md", <<~EOS, after: "## Implementation a.\n"
|
96
|
-
The CI/CD pipeline utilizes multiple tools to perform static code analysis for security and privacy:
|
97
|
-
|
98
|
-
* **Brakeman** is a static code scanner designed to find security issues in Ruby on Rails code. It can flag potential SQL injection,
|
99
|
-
Command Injection, open redirects, and other common vulnerabilities.
|
100
|
-
* **bundle-audit** checks Ruby dependencies against a database of known CVE numbers.
|
101
|
-
* **yarn audit** checks Javascript dependencies against a database of known CVE numbers.
|
102
|
-
* **OWASP ZAP** is a dynamic security scanner that can simulate actual attacks on a running server.
|
103
|
-
|
104
|
-
An additional RAILS_ENV has been created called ci. It inherits from production to ensure that the system being tested is as close as possible to production while allowing for overrides such as bypassing authentication in a secure way.
|
105
|
-
EOS
|
106
|
-
insert_into_oscal "sa-11.md", <<~EOS, after: "## Implementation b.\n"
|
107
|
-
#{ci} runs rspec tests for unit, integration, and regression testing at every code push to github.com and every Pull Request.
|
108
|
-
EOS
|
109
|
-
insert_into_oscal "sa-11.md", <<~EOS, after: "## Implementation c.\n"
|
110
|
-
Test and scan results can be viewed from within #{ci} for every run of the pipeline.
|
111
|
-
|
112
|
-
When #{ci} is run as a result of a Pull Request, the status of the tests and scans are automatically reported as part of the Pull Request.
|
113
|
-
EOS
|
114
|
-
end
|
115
|
-
|
116
|
-
def update_sa22_oscal_doc
|
117
|
-
insert_into_oscal "sa-22.md", <<~EOS, after: "## Implementation a.\n"
|
118
|
-
The #{app_name} application is built and supported by the #{app_name} DevOps staff.
|
119
|
-
|
120
|
-
#{app_name} utilizes public open source Ruby and NodeJS components.
|
121
|
-
|
122
|
-
#{app_name} utilizes dependency scanning tools Bundle Audit and Yarn Audit to find vulnerable or insecure dependencies.
|
123
|
-
|
124
|
-
If a vulnerable or insecure dependency is found it will be upgraded or replaced. Additionally the #{app_name} team code
|
125
|
-
review processes include a review of the health (up to date, supported, many individuals involved) of direct open source dependencies.
|
126
|
-
EOS
|
127
|
-
insert_into_oscal "sa-22.md", <<~EOS, after: "## Implementation b.\n"
|
128
|
-
There are currently no unsupported system components within #{app_name}. In case an unsupported system component is required
|
129
|
-
to maintain #{app_name}, the #{app_name} System Owner will be consulted to make a determination in coordination with the #{app_name} ISSO and ISSM.
|
130
|
-
EOS
|
131
|
-
end
|
132
|
-
|
133
|
-
def update_sc281_oscal_doc(ci)
|
134
|
-
insert_into_oscal "sc-28.1.md", <<~EOS
|
135
|
-
As an additional layer of protection, all PII data is encrypted using [Active Record Encryption — Ruby on Rails Guides](https://guides.rubyonrails.org/active_record_encryption.html).
|
136
|
-
This encryption is implemented in a using non-deterministic AES-256-GCM through Ruby's openssl library with a 256-bit key and a random initialization vector {rails crypto module}.
|
137
|
-
|
138
|
-
The Data Encryption Key is stored in the credentials.yml file in an encrypted format by Ruby's openssl library using the AES-128-GCM cipher,
|
139
|
-
and is built into the application package.
|
140
|
-
|
141
|
-
The credentials.yml decryption key is stored in #{ci} and injected into the running application as an environmental variable. The application then uses this key
|
142
|
-
to decrypt the credentials.yml file and obtain the Data Encryption Key.
|
143
|
-
|
144
|
-
A backup of the key is stored by the Lead Developer and System Owner within a keepass database stored in Google Drive.
|
145
|
-
EOS
|
146
|
-
end
|
147
|
-
|
148
|
-
def update_si2_oscal_doc
|
149
|
-
insert_into_oscal "si-2.md", <<~EOS, after: "Implementation a.\n"
|
150
|
-
Flaw and vulnerability checks are built into the #{app_name} CI/CD pipeline and automated to ensure compliance.
|
151
|
-
Dynamic vulnerability scans are performed against #{app_name} before a successful deployment and reports issues after every scan.
|
152
|
-
Compliance is documented in sections SA-11 and RA-5. The #{app_name} DevOps team uses GitHub as the Product Backlog to
|
153
|
-
track and prioritize issues related to system flaws.
|
154
|
-
|
155
|
-
The responsibility of remediating flaws and vulnerabilities (once a remediation is available) falls on the #{app_name} Developer,
|
156
|
-
who updates the #{app_name} code and deploys fixes as part of the normal development and CI/CD process.
|
157
|
-
EOS
|
158
|
-
insert_into_oscal "si-2.md", <<~EOS, after: "Implementation b.\n"
|
159
|
-
Any flaws or vulnerabilities resolved in #{app_name} result in a GitHub issue for triage via the #{app_name} CM Configuration Control
|
160
|
-
process described in CM-2(2). After resolving a vulnerability or flaw in #{app_name}, unit tests and integration tests are updated to
|
161
|
-
prevent further inclusion of similar flaws.
|
162
|
-
|
163
|
-
* All GitHub tickets have accompanying Acceptance Criteria that are used to create unit tests.
|
164
|
-
* Unit tests are run on the Development environment when new code is pushed.
|
165
|
-
* Integration tests are run on the Test environment when the remediation is deployed via the CI/CD process to ensure that the production
|
166
|
-
environment does not suffer from any side effects of the vulnerability remediation.
|
167
|
-
* Integration tests are run on the Prod environment when the remediation is deployed via the CI/CD process to validate the remediation and application functionality.
|
168
|
-
* All findings that are not remediated immediately are tracked in the #{app_name} Plan of Action and Milestones (POAM) by #{app_name} Operations and the #{app_name} ISSO.
|
169
|
-
EOS
|
170
|
-
end
|
171
|
-
|
172
|
-
def update_si10_oscal_doc
|
173
|
-
insert_into_oscal "si-10.md", <<~EOS
|
174
|
-
All inputs from the end user are parameterized prior to use to avoid potential sql injection.
|
175
|
-
|
176
|
-
#{app_name} utilizes Brakeman scanner as part of the CI/CD pipeline which further identifies coding practices
|
177
|
-
that may lead to application vulnerabilities that are a result of improper input validation.
|
178
|
-
EOS
|
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
|
188
16
|
end
|
189
17
|
end
|
190
18
|
end
|
data/rails-template-18f.gemspec
CHANGED
@@ -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.
|
35
|
-
spec.add_dependency "activesupport", "~> 7.
|
36
|
-
spec.add_dependency "thor", "~> 1.
|
37
|
-
spec.add_dependency "colorize", "~>
|
34
|
+
spec.add_dependency "railties", "~> 7.1.0"
|
35
|
+
spec.add_dependency "activesupport", "~> 7.1.0"
|
36
|
+
spec.add_dependency "thor", "~> 1.3"
|
37
|
+
spec.add_dependency "colorize", "~> 1.1"
|
38
38
|
|
39
|
-
spec.add_development_dependency "rspec", "~> 3.
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
40
40
|
spec.add_development_dependency "ammeter", "~> 1.1"
|
41
|
-
spec.add_development_dependency "standard", "~> 1.
|
41
|
+
spec.add_development_dependency "standard", "~> 1.36"
|
42
42
|
end
|
data/railsrc
CHANGED