You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- X-Permitted-Cross-Domain-Policies - [Restrict Adobe Flash Player's access to data](https://www.adobe.com/devnet/adobe-media-server/articles/cross-domain-xml-for-streaming.html)
11
+
- Public Key Pinning - Pin certificate fingerprints in the browser to prevent man-in-the-middle attacks due to compromised Certificate Authorites. [Public Key Pinnning Specification](https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21)
11
12
12
13
## Usage
13
14
@@ -21,6 +22,7 @@ The following methods are going to be called, unless they are provided in a `ski
21
22
22
23
*`:set_csp_header`
23
24
*`:set_hsts_header`
25
+
*`:set_hpkp_header`
24
26
*`:set_x_frame_options_header`
25
27
*`:set_x_xss_protection_header`
26
28
*`:set_x_content_type_options_header`
@@ -51,15 +53,24 @@ This gem makes a few assumptions about how you will use some features. For exam
51
53
:img_src => "https:",
52
54
:report_uri => '//example.com/uri-directive'
53
55
}
56
+
config.hpkp = {
57
+
:max_age => 60.days.to_i,
58
+
:include_subdomains => true,
59
+
:report_uri => '//example.com/uri-directive',
60
+
:pins => [
61
+
{:sha256 => 'abc'},
62
+
{:sha256 => '123'}
63
+
]
64
+
}
54
65
end
55
66
56
-
# and then simply include this in application_controller.rb
67
+
# and then include this in application_controller.rb
Or do the config as a parameter to `ensure_security_headers`
63
74
64
75
```ruby
65
76
ensure_security_headers(
@@ -298,6 +309,26 @@ console.log("will raise an exception if not in script_hashes.yml!")
298
309
<% end %>
299
310
```
300
311
312
+
### Public Key Pins
313
+
314
+
Be aware that pinning error reporting is governed by the same rules as everything else. If you have a pinning failure that tries to report back to the same origin, by definition this will not work.
315
+
316
+
```
317
+
config.hpkp = {
318
+
max_age: 60.days.to_i, # max_age is a required parameter
319
+
include_subdomains: true, # whether or not to apply pins to subdomains
320
+
# Per the spec, SHA256 hashes are the only currently supported format.
0 commit comments