rails_template_18f 0.1.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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.standard.yml +2 -0
- data/CHANGELOG.md +6 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +132 -0
- data/LICENSE.md +21 -0
- data/README.md +140 -0
- data/Rakefile +10 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/lib/generators/rails_template18f/circleci/circleci_generator.rb +116 -0
- data/lib/generators/rails_template18f/circleci/templates/Dockerfile.tt +13 -0
- data/lib/generators/rails_template18f/circleci/templates/bin/ci-server-start +8 -0
- data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +413 -0
- data/lib/generators/rails_template18f/circleci/templates/docker-compose.ci.yml +26 -0
- data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +137 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/run-server/action.yml +28 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-languages/action.yml.tt +20 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt +33 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/brakeman-analysis.yml +44 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml +39 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +53 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +53 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt +44 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt +47 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt +65 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/rspec.yml.tt +34 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +79 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +79 -0
- data/lib/rails_template18f/terraform_options.rb +68 -0
- data/lib/rails_template18f/version.rb +5 -0
- data/lib/rails_template_18f.rb +13 -0
- data/rails-template-18f.gemspec +40 -0
- data/railsrc +10 -0
- data/railsrc-hotwire +8 -0
- data/template.rb +506 -0
- data/templates/README.md.tt +213 -0
- data/templates/app/assets/images/uswds.js +5 -0
- data/templates/app/assets/stylesheets/uswds-settings.scss +7 -0
- data/templates/app/views/application/_banner_lock_icon.html.erb +19 -0
- data/templates/app/views/application/_demo_site_banner.html.erb +3 -0
- data/templates/app/views/application/_header.html.erb +26 -0
- data/templates/app/views/application/_usa_banner.html.erb +51 -0
- data/templates/bin/owasp-scan +49 -0
- data/templates/bin/pa11y-scan +10 -0
- data/templates/bin/with-server +35 -0
- data/templates/browserslistrc +5 -0
- data/templates/config/deployment/production.yml +3 -0
- data/templates/config/deployment/staging.yml +3 -0
- data/templates/config/environments/ci.rb +10 -0
- data/templates/config/environments/staging.rb +6 -0
- data/templates/config/locales/en.yml.tt +25 -0
- data/templates/config/locales/es.yml +19 -0
- data/templates/config/locales/fr.yml +22 -0
- data/templates/config/locales/zh.yml +16 -0
- data/templates/config/newrelic.yml +65 -0
- data/templates/doc/adr/0001-record-architecture-decisions.md.tt +21 -0
- data/templates/doc/adr/0002-initial-architecture-decisions.md.tt +24 -0
- data/templates/doc/adr/0003-security-scans.md.tt +44 -0
- data/templates/doc/adr/0004-rails-csp-compliant-script-tag-helpers.md.tt +53 -0
- data/templates/doc/compliance/README.md +37 -0
- data/templates/doc/compliance/apps/application.boundary.md.tt +80 -0
- data/templates/doc/compliance/apps/data.logical.md +21 -0
- data/templates/doc/compliance/rendered/apps/.keep +0 -0
- data/templates/editorconfig +5 -0
- data/templates/env +10 -0
- data/templates/githooks/pre-commit.tt +35 -0
- data/templates/lib/tasks/cf.rake +9 -0
- data/templates/lib/tasks/scanning.rake +63 -0
- data/templates/manifest.yml.tt +19 -0
- data/templates/pa11yci +9 -0
- data/templates/terraform/README.md.tt +148 -0
- data/templates/terraform/bootstrap/import.sh +12 -0
- data/templates/terraform/bootstrap/main.tf.tt +25 -0
- data/templates/terraform/bootstrap/providers.tf +16 -0
- data/templates/terraform/bootstrap/run.sh.tt +12 -0
- data/templates/terraform/bootstrap/teardown_creds.sh.tt +5 -0
- data/templates/terraform/bootstrap/variables.tf +2 -0
- data/templates/terraform/create_space_deployer.sh +33 -0
- data/templates/terraform/destroy_space_deployer.sh +19 -0
- data/templates/terraform/production/main.tf.tt +50 -0
- data/templates/terraform/production/providers.tf.tt +17 -0
- data/templates/terraform/production/variables.tf +2 -0
- data/templates/terraform/shared/database/main.tf.tt +23 -0
- data/templates/terraform/shared/database/providers.tf +16 -0
- data/templates/terraform/shared/database/variables.tf +42 -0
- data/templates/terraform/shared/domain/main.tf.tt +46 -0
- data/templates/terraform/shared/domain/providers.tf +16 -0
- data/templates/terraform/shared/domain/variables.tf +47 -0
- data/templates/terraform/shared/s3/main.tf +27 -0
- data/templates/terraform/shared/s3/providers.tf +16 -0
- data/templates/terraform/shared/s3/variables.tf +43 -0
- data/templates/terraform/staging/main.tf.tt +30 -0
- data/templates/terraform/staging/providers.tf.tt +17 -0
- data/templates/terraform/staging/variables.tf +2 -0
- data/templates/zap.conf +121 -0
- metadata +213 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<%= app_name.titleize %>
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
<<TKTK: quick summary of project>>
|
|
5
|
+
|
|
6
|
+
## Development
|
|
7
|
+
|
|
8
|
+
If you're new to Rails, see the [Getting Started with Rails](https://guides.rubyonrails.org/getting_started.html)
|
|
9
|
+
guide for an introduction to the framework.
|
|
10
|
+
|
|
11
|
+
### Local Setup
|
|
12
|
+
|
|
13
|
+
* Install Ruby <%= @ruby_version %>
|
|
14
|
+
* Install NodeJS <%= @node_version %>
|
|
15
|
+
* Install PostgreSQL: `brew install postgresql`
|
|
16
|
+
* Add postgres to your PATH if it wasn't done automatically
|
|
17
|
+
`echo 'export PATH="/usr/local/opt/postgresql/bin:$PATH"' >> ~/.zshrc`
|
|
18
|
+
* Start the server
|
|
19
|
+
`brew services start postgresql`
|
|
20
|
+
* Install Ruby dependencies: `bundle install`
|
|
21
|
+
* Install chromedriver for integration tests: `brew install --cask chromedriver`
|
|
22
|
+
* Chromedriver must be allowed to run. You can either do that by:
|
|
23
|
+
* The command line: `xattr -d com.apple.quarantine $(which chromedriver)` (this is the only option if you are on Big Sur)
|
|
24
|
+
* Manually: clicking "allow" when you run the integration tests for the first time and a dialogue opens up
|
|
25
|
+
* Install JS dependencies: `yarn install`
|
|
26
|
+
* Create database: `bundle exec rake db:create`
|
|
27
|
+
* Run migrations: `bundle exec rake db:migrate`
|
|
28
|
+
* Run the server: `bundle exec rails s`
|
|
29
|
+
* Visit the site: http://localhost:3000
|
|
30
|
+
|
|
31
|
+
### Local Configuration
|
|
32
|
+
|
|
33
|
+
Environment variables can be set in development using the [dotenv](https://github.com/bkeepers/dotenv) gem.
|
|
34
|
+
|
|
35
|
+
Consistent but sensitive credentials should be added to `config/credentials.yml.env` by using `$ rails credentials:edit`
|
|
36
|
+
|
|
37
|
+
Production credentials should be added to `config/credentials/production.yml.env` by using `$ rails credentials:edit --environment production`
|
|
38
|
+
|
|
39
|
+
Any changes to variables in `.env` that should not be checked into git should be set
|
|
40
|
+
in `.env.local`.
|
|
41
|
+
|
|
42
|
+
If you wish to override a config globally for the `test` Rails environment you can set it in `.env.test.local`.
|
|
43
|
+
However, any config that should be set on other machines should either go into `.env` or be explicitly set as part
|
|
44
|
+
of the test.
|
|
45
|
+
|
|
46
|
+
## Security
|
|
47
|
+
|
|
48
|
+
### Authentication
|
|
49
|
+
|
|
50
|
+
TBD
|
|
51
|
+
|
|
52
|
+
### Inline `<script>` and `<style>` security
|
|
53
|
+
|
|
54
|
+
The system's Content-Security-Policy header prevents `<script>` and `<style>` tags from working without further
|
|
55
|
+
configuration. Use `<%%= javascript_tag nonce: true %>` for inline javascript.
|
|
56
|
+
<% if @adrs %>
|
|
57
|
+
See the [CSP compliant script tag helpers](./doc/adr/0004-rails-csp-compliant-script-tag-helpers.md) ADR for
|
|
58
|
+
more information on setting these up successfully.
|
|
59
|
+
<% end %>
|
|
60
|
+
|
|
61
|
+
## Internationalization
|
|
62
|
+
|
|
63
|
+
### Managing locale files
|
|
64
|
+
|
|
65
|
+
We use the gem `i18n-tasks` to manage locale files. Here are a few common tasks:
|
|
66
|
+
|
|
67
|
+
Add missing keys across locales:
|
|
68
|
+
```
|
|
69
|
+
$ i18n-tasks missing # shows missing keys
|
|
70
|
+
$ i18n-tasks add-missing # adds missing keys across locale files
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Key sorting:
|
|
74
|
+
```
|
|
75
|
+
$ i18n-tasks normalize
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Removing unused keys:
|
|
79
|
+
```
|
|
80
|
+
$ i18n-tasks unused # shows unused keys
|
|
81
|
+
$ i18n-tasks remove-unused # removes unused keys across locale files
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For more information on usage and helpful rake tasks to manage locale files, see [the documentation](https://github.com/glebm/i18n-tasks#usage).
|
|
85
|
+
|
|
86
|
+
## Testing
|
|
87
|
+
|
|
88
|
+
### Running tests
|
|
89
|
+
|
|
90
|
+
* Tests: `bundle exec rake spec`
|
|
91
|
+
* Ruby linter: `bundle exec rake standard`
|
|
92
|
+
* Accessibility scan: `./bin/pa11y-scan`
|
|
93
|
+
* Dynamic security scan: `./bin/owasp-scan`
|
|
94
|
+
* Ruby static security scan: `bundle exec rake brakeman`
|
|
95
|
+
* Ruby dependency checks: `bundle exec rake bundler:audit`
|
|
96
|
+
* JS dependency checks: `bundle exec rake yarn:audit`
|
|
97
|
+
|
|
98
|
+
Run everything: `bundle exec rake`
|
|
99
|
+
|
|
100
|
+
#### Pa11y Scan
|
|
101
|
+
|
|
102
|
+
When new pages are added to the application, ensure they are added to `./.pa11yci` so that they can be scanned.
|
|
103
|
+
|
|
104
|
+
### Automatic linting <% if @terraform %>and terraform formatting<% end %>
|
|
105
|
+
|
|
106
|
+
To enable automatic ruby linting<% if @terraform %> and terraform formatting<% end %> on every `git commit`
|
|
107
|
+
follow the instructions at the top of `.githooks/pre-commit`
|
|
108
|
+
|
|
109
|
+
## CI/CD
|
|
110
|
+
|
|
111
|
+
### Deployment
|
|
112
|
+
|
|
113
|
+
Each environment has dependencies on a PostgreSQL RDS instance managed by cloud.gov.
|
|
114
|
+
See [cloud.gov docs](https://cloud.gov/docs/services/relational-database/) for information on RDS.
|
|
115
|
+
|
|
116
|
+
#### Staging
|
|
117
|
+
|
|
118
|
+
<% if !@github_actions && !@circleci_pipeline %>
|
|
119
|
+
<% if @terraform %>
|
|
120
|
+
Follow the instructions in `terraform/README.md` to create the supporting services.
|
|
121
|
+
<% else %>
|
|
122
|
+
Before the first deploy only, create DB service with `cf create-service aws-rds micro-psql <%= app_name %>-rds-staging`
|
|
123
|
+
<% end %>
|
|
124
|
+
`cf push --strategy rolling --vars-file config/deployment/staging.yml --var rails_master_key=$(cat config/master.key)`
|
|
125
|
+
<% end %>
|
|
126
|
+
|
|
127
|
+
#### Production
|
|
128
|
+
|
|
129
|
+
<% if !@github_actions && !@circleci_pipeline %>
|
|
130
|
+
<% if @terraform %>
|
|
131
|
+
Follow the instructions in `terraform/README.md` to create the supporting services.
|
|
132
|
+
<% else %>
|
|
133
|
+
Before the first deploy only, create DB service with `cf create-service aws-rds <<SERVICE_PLAN_NAME>> <%= app_name %>-rds-production`
|
|
134
|
+
<% end %>
|
|
135
|
+
`cf push --strategy rolling --vars-file config/deployment/production.yml --var rails_master_key=$(cat config/credentials/production.key)`
|
|
136
|
+
<% end %>
|
|
137
|
+
|
|
138
|
+
### Configuring ENV variables in cloud.gov
|
|
139
|
+
|
|
140
|
+
All configuration that needs to be added to the deployed application's ENV should be added to
|
|
141
|
+
the `env:` block in `manifest.yml`
|
|
142
|
+
|
|
143
|
+
Items that are both **public** and **consistent** across staging and production can be set directly there.
|
|
144
|
+
|
|
145
|
+
Otherwise, they are set as a `((variable))` within `manifest.yml` and the variable is defined depending on sensitivity:
|
|
146
|
+
|
|
147
|
+
#### Credentials and other Secrets
|
|
148
|
+
|
|
149
|
+
#### Non-secrets
|
|
150
|
+
|
|
151
|
+
Configuration that changes from staging to production, but is public, should be added to `config/deployment/staging.yml` and `config/deployment/production.yml`
|
|
152
|
+
|
|
153
|
+
<% if @newrelic %>
|
|
154
|
+
## Monitoring with New Relic
|
|
155
|
+
|
|
156
|
+
The [New Relic Ruby agent](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/introduction-new-relic-ruby) has been installed for monitoring this application.
|
|
157
|
+
|
|
158
|
+
The config lives at `config/newrelic.yml`, and points to a [FEDRAMP version of the New Relic service as its host](https://docs.newrelic.com/docs/security/security-privacy/compliance/fedramp-compliant-endpoints/). To access the metrics dashboard, you will need to be connected to VPN.
|
|
159
|
+
|
|
160
|
+
### Getting started
|
|
161
|
+
|
|
162
|
+
To get started sending metrics via New Relic APM:
|
|
163
|
+
1. Replace `<APPNAME>` in `config/newrelic.yml` with what is registered for your application in New Relic
|
|
164
|
+
1. Add your New Relic license key to the Rails credentials with key `new_relic_key`.
|
|
165
|
+
1. Comment out the `agent_enabled: false` line in `config/newrelic.yml`
|
|
166
|
+
1. Add the [Javascript snippet provided by New Relic](https://docs.newrelic.com/docs/browser/browser-monitoring/installation/install-browser-monitoring-agent) into `application.html.erb`. It is recommended to vary this based on environment (i.e. include one snippet for staging and another for production).
|
|
167
|
+
<% end %>
|
|
168
|
+
|
|
169
|
+
<% if @dap %>
|
|
170
|
+
## Analytics
|
|
171
|
+
|
|
172
|
+
Digital Analytics Program (DAP) code has been included for the Production environment, associated with GSA.
|
|
173
|
+
|
|
174
|
+
If <%= app_name.titleize %> is for another agency, update the agency line in `app/views/layouts/application.html.erb`
|
|
175
|
+
<% end %>
|
|
176
|
+
|
|
177
|
+
## Documentation
|
|
178
|
+
|
|
179
|
+
<% if @adrs %>
|
|
180
|
+
|
|
181
|
+
Architectural Decision Records (ADR) are stored in `doc/adr`
|
|
182
|
+
To create a new ADR, first install [ADR-tools](https://github.com/npryce/adr-tools) if you don't
|
|
183
|
+
already have it installed.
|
|
184
|
+
* `brew install adr-tools`
|
|
185
|
+
|
|
186
|
+
Then create the ADR:
|
|
187
|
+
* `adr new Title Of Architectural Decision`
|
|
188
|
+
|
|
189
|
+
This will create a new, numbered ADR in the `doc/adr` directory.
|
|
190
|
+
<% end %>
|
|
191
|
+
|
|
192
|
+
Compliance diagrams are stored in `doc/compliance`. See the README there for more information on
|
|
193
|
+
generating diagram updates.
|
|
194
|
+
|
|
195
|
+
## Contributing
|
|
196
|
+
|
|
197
|
+
*This will continue to evolve as the project moves forward.*
|
|
198
|
+
|
|
199
|
+
* Pull down the most recent main before checking out a branch
|
|
200
|
+
* Write your code<% if @adrs %>
|
|
201
|
+
* If a big architectural decision was made, add an ADR<% end %>
|
|
202
|
+
* Submit a PR
|
|
203
|
+
* If you added functionality, please add tests.
|
|
204
|
+
* All tests must pass!
|
|
205
|
+
* Ping the other engineers for a review.
|
|
206
|
+
* At least one approving review is required for merge.
|
|
207
|
+
* Rebase against main before merge to ensure your code is up-to-date!
|
|
208
|
+
* Merge after review.
|
|
209
|
+
* Squash commits into meaningful chunks of work and ensure that your commit messages convey meaning.
|
|
210
|
+
|
|
211
|
+
## Story Acceptance
|
|
212
|
+
|
|
213
|
+
TBD
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<span class="icon-lock">
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
width="52"
|
|
5
|
+
height="64"
|
|
6
|
+
viewBox="0 0 52 64"
|
|
7
|
+
class="usa-banner__lock-image"
|
|
8
|
+
role="img"
|
|
9
|
+
aria-labelledby="banner-lock-title banner-lock-description"
|
|
10
|
+
>
|
|
11
|
+
<title id="banner-lock-title"><%= t('shared.banner.lock') %></title>
|
|
12
|
+
<desc id="banner-lock-description"><%= t('shared.banner.locked_padlock') %></desc>
|
|
13
|
+
<path
|
|
14
|
+
fill="#000000"
|
|
15
|
+
fill-rule="evenodd"
|
|
16
|
+
d="M26 0c10.493 0 19 8.507 19 19v9h3a4 4 0 0 1 4 4v28a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V32a4 4 0 0 1 4-4h3v-9C7 8.507 15.507 0 26 0zm0 8c-5.979 0-10.843 4.77-10.996 10.712L15 19v9h22v-9c0-6.075-4.925-11-11-11z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
</span>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div class="usa-overlay"></div>
|
|
2
|
+
<header class="usa-header usa-header--basic">
|
|
3
|
+
<%= render "application/demo_site_banner" if Rails.configuration.x.show_demo_banner %>
|
|
4
|
+
<div class="usa-nav-container">
|
|
5
|
+
<div class="usa-navbar">
|
|
6
|
+
<div class="usa-logo">
|
|
7
|
+
<em class="usa-logo__text">
|
|
8
|
+
<%= link_to t('shared.header.title'), root_path %>
|
|
9
|
+
</em>
|
|
10
|
+
</div>
|
|
11
|
+
<button class="usa-menu-btn"><%= t('shared.header.menu') %></button>
|
|
12
|
+
</div>
|
|
13
|
+
<nav aria-label="<%= t('shared.header.primary') %>" class="usa-nav">
|
|
14
|
+
<button class="usa-nav__close">
|
|
15
|
+
<%= image_tag "uswds/dist/img/usa-icons/close.svg", role: "img", alt: t('shared.header.close') %>
|
|
16
|
+
</button>
|
|
17
|
+
<ul class="usa-nav__primary usa-accordion">
|
|
18
|
+
<% I18n.available_locales.each do |l| %>
|
|
19
|
+
<li class="usa-nav__primary-item">
|
|
20
|
+
<%= format_active_locale(l) %>
|
|
21
|
+
</li>
|
|
22
|
+
<% end %>
|
|
23
|
+
</ul>
|
|
24
|
+
</nav>
|
|
25
|
+
</div>
|
|
26
|
+
</header>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<a class="usa-skipnav" href="#main-content"><%= t('shared.skip_link') %></a>
|
|
2
|
+
|
|
3
|
+
<section class="usa-banner site-banner" aria-label="<%= t('shared.banner.official_site') %>">
|
|
4
|
+
<div class="usa-accordion">
|
|
5
|
+
<header class="usa-banner__header">
|
|
6
|
+
<div class="usa-banner__inner">
|
|
7
|
+
<div class="grid-col-auto">
|
|
8
|
+
<%= image_tag "uswds/dist/img/us_flag_small.png", alt: t('shared.banner.us_flag'), class: "usa-banner__header-flag" %>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="grid-col-fill tablet:grid-col-auto">
|
|
11
|
+
<p class="usa-banner__header-text">
|
|
12
|
+
<%= t('shared.banner.official_site') %>
|
|
13
|
+
</p>
|
|
14
|
+
<p class="usa-banner__header-action" aria-hidden="true">
|
|
15
|
+
<%= t('shared.banner.how') %>
|
|
16
|
+
</p>
|
|
17
|
+
</div>
|
|
18
|
+
<button
|
|
19
|
+
class="usa-accordion__button usa-banner__button"
|
|
20
|
+
aria-expanded="false"
|
|
21
|
+
aria-controls="gov-banner"
|
|
22
|
+
>
|
|
23
|
+
<span class="usa-banner__button-text"><%= t('shared.banner.how') %></span>
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
</header>
|
|
27
|
+
<div class="usa-banner__content usa-accordion__content" id="gov-banner">
|
|
28
|
+
<%= javascript_tag nonce: true do %>
|
|
29
|
+
document.getElementById('gov-banner').setAttribute('hidden', '');
|
|
30
|
+
<% end %>
|
|
31
|
+
<div class="grid-row grid-gap-lg">
|
|
32
|
+
<div class="usa-banner__guidance tablet:grid-col-6">
|
|
33
|
+
<%= image_tag "uswds/dist/img/icon-dot-gov.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
|
|
34
|
+
<div class="usa-media-block__body">
|
|
35
|
+
<strong><%= t('shared.banner.gov_heading') %></strong>
|
|
36
|
+
<br> <%= t('shared.banner.gov_description_html') %>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="usa-banner__guidance tablet:grid-col-6">
|
|
40
|
+
<%= image_tag "uswds/dist/img/icon-https.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
|
|
41
|
+
<div class="usa-media-block__body">
|
|
42
|
+
<p>
|
|
43
|
+
<strong><%= t('shared.banner.secure_heading') %></strong>
|
|
44
|
+
<br> <%= t('shared.banner.secure_description_html', lock_icon: render('application/banner_lock_icon')) %>
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</section>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
usage="
|
|
4
|
+
$0: Run OWASP Zap scan against local server
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
$0 -h
|
|
8
|
+
$0 [-f] [-s]
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
-h: show help and exit
|
|
12
|
+
-f: run full scan
|
|
13
|
+
-s: run with zap2docker-stable docker image
|
|
14
|
+
|
|
15
|
+
Notes:
|
|
16
|
+
* defaults to running a baseline scan in zap2docker-weekly
|
|
17
|
+
* prerequisites:
|
|
18
|
+
* db must be running
|
|
19
|
+
* docker must be running
|
|
20
|
+
* nothing listening on port 3000
|
|
21
|
+
* script currently only works on macOS
|
|
22
|
+
"
|
|
23
|
+
|
|
24
|
+
set -e
|
|
25
|
+
|
|
26
|
+
scan="zap-baseline.py"
|
|
27
|
+
docker_name="owasp/zap2docker-weekly"
|
|
28
|
+
|
|
29
|
+
while getopts "hfs" opt; do
|
|
30
|
+
case "$opt" in
|
|
31
|
+
f)
|
|
32
|
+
scan="zap-full-scan.py"
|
|
33
|
+
;;
|
|
34
|
+
s)
|
|
35
|
+
docker_name="owasp/zap2docker-stable"
|
|
36
|
+
;;
|
|
37
|
+
*)
|
|
38
|
+
echo "$usage"
|
|
39
|
+
exit 1
|
|
40
|
+
;;
|
|
41
|
+
esac
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
hostname="http://host.docker.internal:3000"
|
|
46
|
+
args="-c zap.conf -I -r zap_report.html"
|
|
47
|
+
cmd="docker run --rm --user root -v $(pwd):/zap/wrk/:rw -t $docker_name $scan -t $hostname $args"
|
|
48
|
+
|
|
49
|
+
`dirname "$0"`/with-server "$cmd"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Run the passed arguments in a near-production configuration
|
|
4
|
+
#
|
|
5
|
+
# prerequisits:
|
|
6
|
+
# * db is running
|
|
7
|
+
# * no other server is listening on port 3000
|
|
8
|
+
|
|
9
|
+
if [[ $# -eq 0 ]]; then
|
|
10
|
+
echo "You must pass the test to run against the CI environment server"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export RAILS_ENV=ci
|
|
15
|
+
|
|
16
|
+
# ensure assets are properly compiled for CI environment
|
|
17
|
+
bundle exec rake assets:clobber
|
|
18
|
+
bundle exec rake assets:precompile
|
|
19
|
+
|
|
20
|
+
# run the server
|
|
21
|
+
bundle exec rails server &
|
|
22
|
+
server_pid=$!
|
|
23
|
+
# pause to ensure the server has started
|
|
24
|
+
sleep 5
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
$@
|
|
28
|
+
exit_status=$?
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# shut down the server and cleanup after ourselves
|
|
32
|
+
bundle exec rake assets:clobber
|
|
33
|
+
kill $server_pid
|
|
34
|
+
|
|
35
|
+
exit $exit_status
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require_relative "./production"
|
|
2
|
+
|
|
3
|
+
Rails.application.configure do
|
|
4
|
+
config.assets.compile = true
|
|
5
|
+
config.public_file_server.enabled = true
|
|
6
|
+
|
|
7
|
+
logger = ActiveSupport::Logger.new($stdout)
|
|
8
|
+
logger.formatter = config.log_formatter
|
|
9
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
10
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
en:
|
|
3
|
+
shared:
|
|
4
|
+
banner:
|
|
5
|
+
gov_description_html: A <strong>.gov</strong> website belongs to an official government organization in the United States.
|
|
6
|
+
gov_heading: Official websites use .gov
|
|
7
|
+
how: Here’s how you know
|
|
8
|
+
lock: Lock
|
|
9
|
+
locked_padlock: A locked padlock
|
|
10
|
+
official_site: An official website of the United States government
|
|
11
|
+
secure_description_html: A <strong>lock</strong> (%{lock_icon}) or <strong>https://</strong> means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.
|
|
12
|
+
secure_heading: Secure .gov websites use HTTPS
|
|
13
|
+
us_flag: U.S. Flag
|
|
14
|
+
header:
|
|
15
|
+
title: <%= app_name.titleize %>
|
|
16
|
+
menu: Menu
|
|
17
|
+
close: Close
|
|
18
|
+
primary: Primary navigation
|
|
19
|
+
demo_banner: TEST SITE - Do not use real personal information (demo purposes only) - TEST SITE
|
|
20
|
+
languages:
|
|
21
|
+
en: English
|
|
22
|
+
es: Español
|
|
23
|
+
fr: Français
|
|
24
|
+
zh: 中文
|
|
25
|
+
skip_link: Skip to main content
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
es:
|
|
3
|
+
shared:
|
|
4
|
+
banner:
|
|
5
|
+
gov_description_html: Un sitio web <strong>.gov</strong> pertenece a una organización oficial del Gobierno de Estados Unidos.
|
|
6
|
+
gov_heading: Los sitios web oficiales usan .gov
|
|
7
|
+
how: Así es como usted puede verificarlo
|
|
8
|
+
lock: Candado
|
|
9
|
+
locked_padlock: Candado cerrado
|
|
10
|
+
official_site: Un sitio oficial del Gobierno de Estados Unidos
|
|
11
|
+
secure_description_html: Un <strong>candado</strong> (%{lock_icon}) o <strong>https://</strong> significa que usted se conectó de forma segura a un sitio web .gov. Comparta información sensible sólo en sitios web oficiales y seguros.
|
|
12
|
+
secure_heading: Los sitios web seguros .gov usan HTTPS
|
|
13
|
+
us_flag: Bandera de Estados Unidos
|
|
14
|
+
header:
|
|
15
|
+
menu: Menú
|
|
16
|
+
close: Cerrar
|
|
17
|
+
primary: Navegacion primaria
|
|
18
|
+
demo_banner: SITIO DE PRUEBA - No utilice información personal real (sólo para propósitos de demostración) - SITIO DE PRUEBA
|
|
19
|
+
skip_link: Salte al contenido principal
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
fr:
|
|
3
|
+
shared:
|
|
4
|
+
banner:
|
|
5
|
+
gov_description_html: Un site Web <strong>.gov</strong> appartient à une organisation gouvernementale officielle des États-Unis.
|
|
6
|
+
gov_heading: Les sites Web officiels utilisent .gov
|
|
7
|
+
how: Voici comment vous savez
|
|
8
|
+
lock: Verrou
|
|
9
|
+
locked_padlock: Verrou fermé
|
|
10
|
+
official_site: Un site web officiel du gouvernement des États-Unis
|
|
11
|
+
secure_description_html: Un <strong>verrou</strong> (%{lock_icon}) ou
|
|
12
|
+
<strong>https://</strong> signifie que vous êtes connecté en toute
|
|
13
|
+
sécurité au site Web .gov. Partagez des informations sensibles
|
|
14
|
+
uniquement sur des sites Web officiels et sécurisés.
|
|
15
|
+
secure_heading: Les sites Web sécurisés .gov utilisent HTTPS
|
|
16
|
+
us_flag: Drapeau américain
|
|
17
|
+
header:
|
|
18
|
+
menu: Menu
|
|
19
|
+
close: Fermer
|
|
20
|
+
primary: Navigation primaire
|
|
21
|
+
demo_banner: SITE DE TEST - N’utilisez pas de véritables données personnelles (il s’agit d’une démonstration seulement) - SITE DE TEST
|
|
22
|
+
skip_link: Passer au contenu principal
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
zh:
|
|
3
|
+
shared:
|
|
4
|
+
banner:
|
|
5
|
+
gov_description_html: "<strong>“.gov”</strong>网站为美国官方政府组织机构网站。"
|
|
6
|
+
gov_heading: 官方网站使用“.gov”
|
|
7
|
+
how: 这里是了解途径
|
|
8
|
+
lock: 锁
|
|
9
|
+
locked_padlock: 上锁的挂锁
|
|
10
|
+
official_site: 美国政府的官方网站
|
|
11
|
+
secure_description_html: "<strong>锁形图标</strong> (%{lock_icon}) 或 <strong>“https://”</strong>表示您已安全连接到.gov网站。仅在安全的官方网站上分享敏感信息。"
|
|
12
|
+
secure_heading: 安全的.gov网站使用HTTPS
|
|
13
|
+
us_flag: 美国国旗
|
|
14
|
+
header:
|
|
15
|
+
primary: 主导航
|
|
16
|
+
skip_link: 跳转到主要内容
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file configures the New Relic Agent. New Relic monitors Ruby, Java,
|
|
3
|
+
# .NET, PHP, Python, Node, and Go applications with deep visibility and low
|
|
4
|
+
# overhead. For more information, visit www.newrelic.com.
|
|
5
|
+
#
|
|
6
|
+
# Generated January 12, 2022
|
|
7
|
+
#
|
|
8
|
+
# This configuration file is custom generated for NewRelic Administration
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
common: &default_settings
|
|
12
|
+
# Required license key associated with your New Relic account.
|
|
13
|
+
license_key: <%= Rails.application.credentials.new_relic_key %>
|
|
14
|
+
# FEDRAMP-specific New Relic host
|
|
15
|
+
# https://docs.newrelic.com/docs/security/security-privacy/compliance/fedramp-compliant-endpoints/
|
|
16
|
+
host: 'gov-collector.newrelic.com'
|
|
17
|
+
|
|
18
|
+
# Your application name. Renaming here affects where data displays in New
|
|
19
|
+
# Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
|
|
20
|
+
app_name: <APPNAME>
|
|
21
|
+
|
|
22
|
+
monitor_mode: true
|
|
23
|
+
|
|
24
|
+
distributed_tracing:
|
|
25
|
+
enabled: true
|
|
26
|
+
|
|
27
|
+
browser_monitoring:
|
|
28
|
+
# include js code via partial to comply with CSP settings
|
|
29
|
+
auto_instrument: false
|
|
30
|
+
|
|
31
|
+
# This line disables agent regardless of other settings.
|
|
32
|
+
# To enable the New Relic agent:
|
|
33
|
+
# 1) Replace <APPNAME> in this file with the application name you want to show in New Relic
|
|
34
|
+
# 2) add the New Relic license keys to the appropriate encrypted credentials file(s)
|
|
35
|
+
# 3) Comment out the line below
|
|
36
|
+
agent_enabled: false
|
|
37
|
+
|
|
38
|
+
# Logging level for log/newrelic_agent.log
|
|
39
|
+
log_level: info
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Environment-specific settings are in this section.
|
|
43
|
+
# RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment.
|
|
44
|
+
# If your application has other named environments, configure them here.
|
|
45
|
+
development:
|
|
46
|
+
<<: *default_settings
|
|
47
|
+
app_name: <APPNAME> (Development)
|
|
48
|
+
|
|
49
|
+
test:
|
|
50
|
+
<<: *default_settings
|
|
51
|
+
# It doesn't make sense to report to New Relic from automated test runs.
|
|
52
|
+
monitor_mode: false
|
|
53
|
+
|
|
54
|
+
ci:
|
|
55
|
+
<<: *default_settings
|
|
56
|
+
# It doesn't make sense to report to New Relic from automated test runs.
|
|
57
|
+
monitor_mode: false
|
|
58
|
+
|
|
59
|
+
staging:
|
|
60
|
+
<<: *default_settings
|
|
61
|
+
app_name: <APPNAME> (Staging)
|
|
62
|
+
|
|
63
|
+
production:
|
|
64
|
+
<<: *default_settings
|
|
65
|
+
app_name: <APPNAME> (Production)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 1. Record architecture decisions
|
|
2
|
+
|
|
3
|
+
Date: <%= Date.today.iso8601 %>
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Accepted
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
We need to record decisions made on this project.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
We will use Architecture Decision Records (ADR), as [described by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions).
|
|
16
|
+
|
|
17
|
+
We will use Nat Pryce's [adr-tools](https://github.com/npryce/adr-tools) to simplify the management of ADRs.
|
|
18
|
+
|
|
19
|
+
## Consequences
|
|
20
|
+
|
|
21
|
+
Architectural decisions are available in a consistent format to simplify review for technical and security considerations.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 2. Initial architecture decisions
|
|
2
|
+
|
|
3
|
+
Date: <%= Date.today.iso8601 %>
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Accepted
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
We need to choose the initial language and framework for the <%= app_name %> application.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
We will use:
|
|
16
|
+
|
|
17
|
+
* Language: Ruby
|
|
18
|
+
* Framework: Rails with unused frameworks disabled.
|
|
19
|
+
* Unit tests: RSpec
|
|
20
|
+
* Javascript bundler: webpack
|
|
21
|
+
|
|
22
|
+
## Consequences
|
|
23
|
+
|
|
24
|
+
Ruby on Rails is a common development environment for the developers on this team, leading to faster development timelines.
|