rails_template_18f 0.8.1 → 1.0.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 +12 -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/circleci/circleci_generator.rb +3 -3
  10. data/lib/generators/rails_template18f/circleci/templates/bin/ci-server-start +1 -1
  11. data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +60 -17
  12. data/lib/generators/rails_template18f/circleci/templates/docker-compose.ci.yml +1 -0
  13. data/lib/generators/rails_template18f/circleci/templates/oscal/component-definitions/circleci/component-definition.json.tt +310 -0
  14. data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +7 -12
  15. data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-languages/action.yml.tt +1 -1
  16. data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt +1 -0
  17. data/lib/generators/rails_template18f/github_actions/templates/github/actions/trestle-cmd/action.yml +20 -0
  18. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/assemble-ssp.yml.tt +26 -0
  19. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/brakeman-analysis.yml +6 -2
  20. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml +4 -4
  21. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +15 -28
  22. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +15 -28
  23. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt +8 -3
  24. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt +4 -3
  25. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt +6 -2
  26. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/rspec.yml.tt +1 -1
  27. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +20 -58
  28. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +20 -58
  29. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/validate-ssp.yml.tt +46 -0
  30. data/lib/generators/rails_template18f/github_actions/templates/oscal/component-definitions/github_actions/component-definition.json.tt +310 -0
  31. data/lib/generators/rails_template18f/i18n/i18n_generator.rb +7 -6
  32. data/lib/generators/rails_template18f/i18n/templates/config/locales/en.yml.tt +1 -0
  33. data/lib/generators/rails_template18f/i18n/templates/config/locales/es.yml +2 -0
  34. data/lib/generators/rails_template18f/i18n/templates/config/locales/fr.yml +2 -0
  35. data/lib/generators/rails_template18f/i18n/templates/config/locales/zh.yml +2 -0
  36. data/lib/generators/rails_template18f/newrelic/newrelic_generator.rb +2 -37
  37. data/lib/generators/rails_template18f/newrelic/templates/oscal/component-definitions/newrelic/component-definition.json.tt +113 -0
  38. data/lib/generators/rails_template18f/oscal/oscal_generator.rb +55 -17
  39. data/lib/generators/rails_template18f/oscal/templates/bin/trestle.tt +10 -0
  40. data/lib/generators/rails_template18f/oscal/templates/doc/compliance/oscal/trestle-config.yaml.tt +6 -0
  41. data/lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb +2 -2
  42. data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +37 -52
  43. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/import.sh +1 -0
  44. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt +7 -10
  45. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/providers.tf +3 -3
  46. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt +27 -0
  47. data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +33 -50
  48. data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt +8 -2
  49. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +26 -40
  50. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf.tt +8 -2
  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 +48 -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/ops/create_service_account.sh.tt +11 -5
  68. data/templates/bin/owasp-scan +3 -3
  69. data/templates/bin/pa11y-scan +1 -1
  70. data/templates/config/environments/ci.rb +1 -0
  71. data/templates/pa11y.js +12 -0
  72. data/templates/pa11yci.js +8 -0
  73. metadata +31 -16
  74. data/templates/pa11yci +0 -9
  75. /data/lib/generators/rails_template18f/circleci/templates/{Dockerfile.tt → Dockerfile.ci.tt} +0 -0
@@ -1,48 +1,36 @@
1
1
  locals {
2
- cf_org_name = "<%= cloud_gov_organization %>"
3
- cf_space_name = "<%= cloud_gov_production_space %>"
4
- env = "production"
5
- app_name = "<%= app_name %>"
6
- recursive_delete = false
2
+ cf_org_name = "<%= cloud_gov_organization %>"
3
+ cf_space_name = "<%= cloud_gov_production_space %>"
4
+ env = "production"
5
+ app_name = "<%= app_name %>"
7
6
  }
8
7
 
9
8
  module "database" {
10
- source = "github.com/18f/terraform-cloudgov//database"
9
+ source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v1.0.0"
11
10
 
12
- cf_user = var.cf_user
13
- cf_password = var.cf_password
14
- cf_org_name = local.cf_org_name
15
- cf_space_name = local.cf_space_name
16
- env = local.env
17
- app_name = local.app_name
18
- recursive_delete = local.recursive_delete
19
- rds_plan_name = "TKTK-production-rds-plan"
11
+ cf_org_name = local.cf_org_name
12
+ cf_space_name = local.cf_space_name
13
+ name = "${local.app_name}-rds-${local.env}"
14
+ rds_plan_name = "TKTK-production-rds-plan"
20
15
  }
21
16
  <% if has_active_job? %>
22
17
  module "redis" {
23
- source = "github.com/18f/terraform-cloudgov//redis"
18
+ source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v1.0.0"
24
19
 
25
- cf_user = var.cf_user
26
- cf_password = var.cf_password
27
- cf_org_name = local.cf_org_name
28
- cf_space_name = local.cf_space_name
29
- env = local.env
30
- app_name = local.app_name
31
- recursive_delete = local.recursive_delete
32
- redis_plan_name = "TKTK-production-redis-plan"
20
+ cf_org_name = local.cf_org_name
21
+ cf_space_name = local.cf_space_name
22
+ name = "${local.app_name}-redis-${local.env}"
23
+ redis_plan_name = "TKTK-production-redis-plan"
33
24
  }
34
25
  <% end %>
35
26
  <% if has_active_storage? %>
36
27
  module "s3" {
37
- source = "github.com/18f/terraform-cloudgov//s3"
28
+ source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.0.0"
38
29
 
39
- cf_user = var.cf_user
40
- cf_password = var.cf_password
41
- cf_org_name = local.cf_org_name
42
- cf_space_name = local.cf_space_name
43
- recursive_delete = local.recursive_delete
44
- s3_service_name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
45
- s3_plan_name = "basic-sandbox"<% end %>
30
+ cf_org_name = local.cf_org_name
31
+ cf_space_name = local.cf_space_name
32
+ name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
33
+ s3_plan_name = "basic-sandbox"<% end %>
46
34
  }
47
35
 
48
36
  ###########################################################################
@@ -52,16 +40,14 @@ module "s3" {
52
40
  # 2) Your organization has sufficient memory. Each clamav app requires 3GB
53
41
  ###########################################################################
54
42
  # module "clamav" {
55
- # source = "github.com/18f/terraform-cloudgov//clamav"
43
+ # source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v1.0.0"
56
44
  #
57
- # cf_user = var.cf_user
58
- # cf_password = var.cf_password
59
- # cf_org_name = local.cf_org_name
60
- # cf_space_name = local.cf_space_name
61
- # env = local.env
62
- # app_name = local.app_name
63
- # clamav_image = "ajilaag/clamav-rest:20211229"
64
- # max_file_size = "30M"
45
+ # cf_org_name = local.cf_org_name
46
+ # cf_space_name = local.cf_space_name
47
+ # app_name_or_id = "${local.app_name}-${local.env}"
48
+ # name = "${local.app_name}-clamapi-${local.env}"
49
+ # clamav_image = "ghcr.io/gsa-tts/clamav-rest/clamav:20240602"
50
+ # max_file_size = "30M"
65
51
  # }
66
52
  <% end %>
67
53
 
@@ -73,15 +59,12 @@ module "s3" {
73
59
  # `cf create-domain <%= cloud_gov_organization %> TKTK-production-domain-name`
74
60
  ###########################################################################
75
61
  # module "domain" {
76
- # source = "github.com/18f/terraform-cloudgov//domain"
62
+ # source = "github.com/gsa-tts/terraform-cloudgov//domain?ref=v1.0.0"
77
63
  #
78
- # cf_user = var.cf_user
79
- # cf_password = var.cf_password
80
- # cf_org_name = local.cf_org_name
81
- # cf_space_name = local.cf_space_name
82
- # env = local.env
83
- # app_name = local.app_name
84
- # recursive_delete = local.recursive_delete
85
- # cdn_plan_name = "domain"
86
- # domain_name = "TKTK-production-domain-name"
64
+ # cf_org_name = local.cf_org_name
65
+ # cf_space_name = local.cf_space_name
66
+ # app_name_or_id = "${local.app_name}-${local.env}"
67
+ # cdn_plan_name = "domain"
68
+ # domain_name = "TKTK-production-domain-name"
69
+ # host_name = "TKTK-production-hostname (optional)"
87
70
  # }
@@ -3,7 +3,7 @@ terraform {
3
3
  required_providers {
4
4
  cloudfoundry = {
5
5
  source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.15.0"
6
+ version = "0.53.1"
7
7
  }
8
8
  }
9
9
 
@@ -12,6 +12,12 @@ terraform {
12
12
  key = "terraform.tfstate.prod"
13
13
  encrypt = "true"
14
14
  region = "us-gov-west-1"
15
- profile = "<%= app_name %>-terraform-backend"
16
15
  }
17
16
  }
17
+
18
+ provider "cloudfoundry" {
19
+ api_url = "https://api.fr.cloud.gov"
20
+ user = var.cf_user
21
+ password = var.cf_password
22
+ app_logs_max = 30
23
+ }
@@ -1,48 +1,36 @@
1
1
  locals {
2
- cf_org_name = "<%= cloud_gov_organization %>"
3
- cf_space_name = "<%= cloud_gov_staging_space %>"
4
- env = "staging"
5
- app_name = "<%= app_name %>"
6
- recursive_delete = true
2
+ cf_org_name = "<%= cloud_gov_organization %>"
3
+ cf_space_name = "<%= cloud_gov_staging_space %>"
4
+ env = "staging"
5
+ app_name = "<%= app_name %>"
7
6
  }
8
7
 
9
8
  module "database" {
10
- source = "github.com/18f/terraform-cloudgov//database"
9
+ source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v1.0.0"
11
10
 
12
- cf_user = var.cf_user
13
- cf_password = var.cf_password
14
- cf_org_name = local.cf_org_name
15
- cf_space_name = local.cf_space_name
16
- env = local.env
17
- app_name = local.app_name
18
- recursive_delete = local.recursive_delete
19
- rds_plan_name = "micro-psql"
11
+ cf_org_name = local.cf_org_name
12
+ cf_space_name = local.cf_space_name
13
+ name = "${local.app_name}-rds-${local.env}"
14
+ rds_plan_name = "micro-psql"
20
15
  }
21
16
  <% if has_active_job? %>
22
17
  module "redis" {
23
- source = "github.com/18f/terraform-cloudgov//redis"
18
+ source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v1.0.0"
24
19
 
25
- cf_user = var.cf_user
26
- cf_password = var.cf_password
27
- cf_org_name = local.cf_org_name
28
- cf_space_name = local.cf_space_name
29
- env = local.env
30
- app_name = local.app_name
31
- recursive_delete = local.recursive_delete
32
- redis_plan_name = "redis-dev"
20
+ cf_org_name = local.cf_org_name
21
+ cf_space_name = local.cf_space_name
22
+ name = "${local.app_name}-redis-${local.env}"
23
+ redis_plan_name = "redis-dev"
33
24
  }
34
25
  <% end %>
35
26
  <% if has_active_storage? %>
36
27
  module "s3" {
37
- source = "github.com/18f/terraform-cloudgov//s3"
28
+ source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.0.0"
38
29
 
39
- cf_user = var.cf_user
40
- cf_password = var.cf_password
41
- cf_org_name = local.cf_org_name
42
- cf_space_name = local.cf_space_name
43
- recursive_delete = local.recursive_delete
44
- s3_service_name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
45
- s3_plan_name = "basic-sandbox"<% end %>
30
+ cf_org_name = local.cf_org_name
31
+ cf_space_name = local.cf_space_name
32
+ name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
33
+ s3_plan_name = "basic-sandbox"<% end %>
46
34
  }
47
35
 
48
36
  ###########################################################################
@@ -52,15 +40,13 @@ module "s3" {
52
40
  # 2) Your organization has sufficient memory. Each clamav app requires 3GB
53
41
  ###########################################################################
54
42
  # module "clamav" {
55
- # source = "github.com/18f/terraform-cloudgov//clamav"
43
+ # source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v1.0.0"
56
44
  #
57
- # cf_user = var.cf_user
58
- # cf_password = var.cf_password
59
- # cf_org_name = local.cf_org_name
60
- # cf_space_name = local.cf_space_name
61
- # env = local.env
62
- # app_name = local.app_name
63
- # clamav_image = "ajilaag/clamav-rest:20211229"
64
- # max_file_size = "30M"
45
+ # cf_org_name = local.cf_org_name
46
+ # cf_space_name = local.cf_space_name
47
+ # app_name_or_id = "${local.app_name}-${local.env}"
48
+ # name = "${local.app_name}-clamapi-${local.env}"
49
+ # clamav_image = "ghcr.io/gsa-tts/clamav-rest/clamav:20240602"
50
+ # max_file_size = "30M"
65
51
  # }
66
52
  <% end %>
@@ -3,7 +3,7 @@ terraform {
3
3
  required_providers {
4
4
  cloudfoundry = {
5
5
  source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.15.0"
6
+ version = "0.53.1"
7
7
  }
8
8
  }
9
9
 
@@ -12,6 +12,12 @@ terraform {
12
12
  key = "terraform.tfstate.stage"
13
13
  encrypt = "true"
14
14
  region = "us-gov-west-1"
15
- profile = "<%= app_name %>-terraform-backend"
16
15
  }
17
16
  }
17
+
18
+ provider "cloudfoundry" {
19
+ api_url = "https://api.fr.cloud.gov"
20
+ user = var.cf_user
21
+ password = var.cf_password
22
+ app_logs_max = 30
23
+ }
@@ -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 insert_into_oscal(filename, content, after: "## What is the solution and how is it implemented?\n")
64
- content = <<~EOS
65
-
66
- ### #{app_name}
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 oscal_path
78
- @oscal_path ||= if options[:oscal_profile].present?
79
- file_path(File.join("doc/compliance/oscal/dist/system-security-plans", options[:oscal_profile]))
70
+ def oscal_component_path
71
+ if oscal_dir_exists?
72
+ file_path("doc/compliance/oscal/component-definitions")
80
73
  else
81
- ssp_dir = file_path("doc/compliance/oscal/dist/system-security-plans")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsTemplate18f
4
- VERSION = "0.8.1"
4
+ VERSION = "1.0.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.0.0"
35
- spec.add_dependency "activesupport", "~> 7.0.0"
36
- spec.add_dependency "thor", "~> 1.0"
37
- spec.add_dependency "colorize", "~> 0.8"
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.11"
39
+ spec.add_development_dependency "rspec", "~> 3.13"
40
40
  spec.add_development_dependency "ammeter", "~> 1.1"
41
- spec.add_development_dependency "standard", "~> 1.3"
41
+ spec.add_development_dependency "standard", "~> 1.36"
42
42
  end
data/railsrc CHANGED
@@ -3,6 +3,7 @@
3
3
  --skip-action-cable
4
4
  --skip-action-mailbox
5
5
  --skip-hotwire
6
+ --skip-docker
6
7
  --skip-test
7
8
  --javascript=webpack
8
9
  --css=postcss
data/railsrc-hotwire CHANGED
@@ -1,6 +1,7 @@
1
1
  --skip-active-storage
2
2
  --skip-action-text
3
3
  --skip-action-mailbox
4
+ --skip-docker
4
5
  --skip-test
5
6
  --javascript=webpack
6
7
  --css=postcss