Skip to content

Commit b11b7f8

Browse files
committed
Merge pull request #252 from stefansundin/master
Fix minor papercuts
2 parents e8f5103 + 89cdbf1 commit b11b7f8

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ SecureHeaders::Configuration.default do |config|
4848
config.referrer_policy = "origin-when-cross-origin"
4949
config.csp = {
5050
# "meta" values. these will shaped the header, but the values are not included in the header.
51-
report_only: true, # default: false
51+
report_only: true, # default: false
5252
preserve_schemes: true, # default: false. Schemes are removed from host sources to save bytes and discourage mixed content.
5353

5454
# directive values: these values will directly translate into source directives
@@ -66,7 +66,7 @@ SecureHeaders::Configuration.default do |config|
6666
form_action: %w('self' github.com),
6767
frame_ancestors: %w('none'),
6868
plugin_types: %w(application/x-shockwave-flash),
69-
block_all_mixed_content: true, # see [http://www.w3.org/TR/mixed-content/](http://www.w3.org/TR/mixed-content/)
69+
block_all_mixed_content: true, # see http://www.w3.org/TR/mixed-content/
7070
upgrade_insecure_requests: true, # see https://www.w3.org/TR/upgrade-insecure-requests/
7171
report_uri: %w(https://report-uri.io/example-csp)
7272
}
@@ -85,7 +85,7 @@ end
8585

8686
### rails 2
8787

88-
For rails 3+ applications, `secure_headers` has a `railtie` that should automatically include the middleware. For rails 2 applications, an explicit statement is required to use the middleware component.
88+
For rails 3+ applications, `secure_headers` has a `railtie` that should automatically include the middleware. For rails 2 or non-rails applications, an explicit statement is required to use the middleware component.
8989

9090
```ruby
9191
use SecureHeaders::Middleware
@@ -137,7 +137,7 @@ class MyController < ApplicationController
137137
end
138138
```
139139

140-
By default, a noop configuration is provided. No headers will be set when this default override is used.
140+
By default, a no-op configuration is provided. No headers will be set when this default override is used.
141141

142142
```ruby
143143
class MyController < ApplicationController
@@ -163,12 +163,12 @@ You can override the settings for a given action by producing a temporary overri
163163
class MyController < ApplicationController
164164
def index
165165
# Append value to the source list, override 'none' values
166-
# Produces: default-src 'self'; script-src 'self' s3.amazaonaws.com; object-src 'self' youtube.com
167-
append_content_security_policy_directives(script_src: %w(s3.amazaonaws.com), object_src: %w('self' youtube.com))
166+
# Produces: default-src 'self'; script-src 'self' s3.amazonaws.com; object-src 'self' www.youtube.com
167+
append_content_security_policy_directives(script_src: %w(s3.amazonaws.com), object_src: %w('self' www.youtube.com))
168168

169169
# Overrides the previously set source list, override 'none' values
170-
# Produces: default-src 'self'; script-src s3.amazaonaws.com; object-src 'self'
171-
override_content_security_policy_directives(script_src: %w(s3.amazaonaws.com), object_src: %w('self'))
170+
# Produces: default-src 'self'; script-src s3.amazonaws.com; object-src 'self'
171+
override_content_security_policy_directives(script_src: %w(s3.amazonaws.com), object_src: %w('self'))
172172

173173
# Global settings default to "sameorigin"
174174
override_x_frame_options("DENY")
@@ -207,7 +207,7 @@ You can use a view helper to automatically add nonces to script tags:
207207

208208
```erb
209209
<%= nonced_javascript_tag do %>
210-
console.log("hai");
210+
console.log("nonced!");
211211
<% end %>
212212
213213
<%= nonced_style_tag do %>
@@ -324,14 +324,14 @@ Be aware that pinning error reporting is governed by the same rules as everythin
324324
325325
```ruby
326326
config.hpkp = {
327-
max_age: 60.days.to_i, # max_age is a required parameter
327+
max_age: 60.days.to_i, # max_age is a required parameter
328328
include_subdomains: true, # whether or not to apply pins to subdomains
329329
# Per the spec, SHA256 hashes are the only currently supported format.
330330
pins: [
331331
{sha256: 'b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c'},
332332
{sha256: '73a2c64f9545172c1195efb6616ca5f7afd1df6f245407cafb90de3998a1c97f'}
333333
],
334-
report_only: true, # defaults to false (report-only mode)
334+
report_only: true, # defaults to false (report-only mode)
335335
report_uri: 'https://report-uri.io/example-hpkp'
336336
}
337337
```

lib/tasks/tasks.rake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace :secure_headers do
5454
hashes
5555
end
5656

57+
desc "Generate #{SecureHeaders::Configuration::HASH_CONFIG_FILE}"
5758
task :generate_hashes do |t, args|
5859
script_hashes = {
5960
"scripts" => {},

0 commit comments

Comments
 (0)