Skip to content

Commit 869e8a6

Browse files
committed
Lowercase headers
1 parent b134eef commit 869e8a6

20 files changed

+83
-83
lines changed

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ NOTE: this version is a breaking change due to the removal of HPKP. Remove the H
6262

6363
## 5.0.2
6464

65-
- Updates `Referrer-Policy` header to support multiple policy values
65+
- Updates `referrer-policy` header to support multiple policy values
6666

6767
## 5.0.1
6868

69-
- Updates `Expect-CT` header to use a comma separator between directives, as specified in the most current spec.
69+
- Updates `expect-ct` header to use a comma separator between directives, as specified in the most current spec.
7070

7171
## 5.0.0
7272

@@ -90,7 +90,7 @@ Fix support for the sandbox attribute of CSP. `true` and `[]` represent the maxi
9090

9191
## 3.7.0
9292

93-
Adds support for the `Expect-CT` header (@jacobbednarz: https://github.com/twitter/secureheaders/pull/322)
93+
Adds support for the `expect-ct` header (@jacobbednarz: https://github.com/twitter/secureheaders/pull/322)
9494

9595
## 3.6.7
9696

@@ -335,7 +335,7 @@ console.log(1)
335335
```
336336

337337
```
338-
Content-Security-Policy: ...
338+
content-security-policy: ...
339339
script-src 'sha256-yktKiAsZWmc8WpOyhnmhQoDf9G2dAZvuBBC+V0LGQhg=' ... ;
340340
style-src 'sha256-SLp6LO3rrKDJwsG9uJUxZapb4Wp2Zhj6Bu3l+d9rnAY=' 'sha256-HSGHqlRoKmHAGTAJ2Rq0piXX4CnEbOl1ArNd6ejp2TE=' ...;
341341
```
@@ -552,15 +552,15 @@ Fixes an issue where view helpers (for nonces, hashes, etc) weren't available in
552552

553553
This release contains support for more csp level 2 features such as the new directives, the script hash integration, and more.
554554

555-
It also sets a new header by default: `X-Permitted-Cross-Domain-Policies`
555+
It also sets a new header by default: `x-permitted-cross-domain-policies`
556556

557557
Support for hpkp is not included in this release as the implementations are still very unstable.
558558

559559
:rocket:
560560

561-
## v.2.0.0.pre2 - 2014-12-06 01:55:42 UTC - Adds X-Permitted-Cross-Domain-Policies support by default
561+
## v.2.0.0.pre2 - 2014-12-06 01:55:42 UTC - Adds x-permitted-cross-domain-policies support by default
562562

563-
The only change between this and the first pre release is that the X-Permitted-Cross-Domain-Policies support is included.
563+
The only change between this and the first pre release is that the x-permitted-cross-domain-policies support is included.
564564

565565
## v1.4.0 - 2014-12-06 01:54:48 UTC - Deprecate features in preparation for 2.0
566566

@@ -572,7 +572,7 @@ This release is intended to be ready for CSP level 2. Mainly, this means there i
572572

573573
## v1.3.4 - 2014-10-13 22:05:44 UTC -
574574

575-
* Adds X-Download-Options support
575+
* Adds x-download-options support
576576
* Adds support for X-XSS-Protection reporting
577577
* Defers loading of rails engine for faster boot times
578578

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ The gem will automatically apply several headers that are related to security.
1111
- X-Frame-Options (XFO) - Prevents your content from being framed and potentially clickjacked. [X-Frame-Options Specification](https://tools.ietf.org/html/rfc7034)
1212
- X-XSS-Protection - [Cross site scripting heuristic filter for IE/Chrome](https://msdn.microsoft.com/en-us/library/dd565647\(v=vs.85\).aspx)
1313
- X-Content-Type-Options - [Prevent content type sniffing](https://msdn.microsoft.com/library/gg622941\(v=vs.85\).aspx)
14-
- X-Download-Options - [Prevent file downloads opening](https://msdn.microsoft.com/library/jj542450(v=vs.85).aspx)
15-
- 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)
16-
- Referrer-Policy - [Referrer Policy draft](https://w3c.github.io/webappsec-referrer-policy/)
17-
- Expect-CT - Only use certificates that are present in the certificate transparency logs. [Expect-CT draft specification](https://datatracker.ietf.org/doc/draft-stark-expect-ct/).
18-
- Clear-Site-Data - Clearing browser data for origin. [Clear-Site-Data specification](https://w3c.github.io/webappsec-clear-site-data/).
14+
- x-download-options - [Prevent file downloads opening](https://msdn.microsoft.com/library/jj542450(v=vs.85).aspx)
15+
- 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)
16+
- referrer-policy - [Referrer Policy draft](https://w3c.github.io/webappsec-referrer-policy/)
17+
- expect-ct - Only use certificates that are present in the certificate transparency logs. [expect-ct draft specification](https://datatracker.ietf.org/doc/draft-stark-expect-ct/).
18+
- clear-site-data - Clearing browser data for origin. [clear-site-data specification](https://w3c.github.io/webappsec-clear-site-data/).
1919

2020
It can also mark all http cookies with the Secure, HttpOnly and SameSite attributes. This is on default but can be turned off by using `config.cookies = SecureHeaders::OPT_OUT`.
2121

@@ -92,19 +92,19 @@ end
9292
```
9393

9494
### Deprecated Configuration Values
95-
* `block_all_mixed_content` - this value is deprecated in favor of `upgrade_insecure_requests`. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content for more information.
95+
* `block_all_mixed_content` - this value is deprecated in favor of `upgrade_insecure_requests`. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/content-security-policy/block-all-mixed-content for more information.
9696

9797
## Default values
9898

9999
All headers except for PublicKeyPins and ClearSiteData have a default value. The default set of headers is:
100100

101101
```
102-
Content-Security-Policy: default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline'
103-
Strict-Transport-Security: max-age=631138519
102+
content-security-policy: default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline'
103+
strict-transport-security: max-age=631138519
104104
X-Content-Type-Options: nosniff
105-
X-Download-Options: noopen
105+
x-download-options: noopen
106106
X-Frame-Options: sameorigin
107-
X-Permitted-Cross-Domain-Policies: none
107+
x-permitted-cross-domain-policies: none
108108
X-Xss-Protection: 0
109109
```
110110

docs/hashes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ console.log(1)
5858
```
5959

6060
```
61-
Content-Security-Policy: ...
61+
content-security-policy: ...
6262
script-src 'sha256-yktKiAsZWmc8WpOyhnmhQoDf9G2dAZvuBBC+V0LGQhg=' ... ;
6363
style-src 'sha256-SLp6LO3rrKDJwsG9uJUxZapb4Wp2Zhj6Bu3l+d9rnAY=' 'sha256-HSGHqlRoKmHAGTAJ2Rq0piXX4CnEbOl1ArNd6ejp2TE=' ...;
6464
```

docs/per_action_configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ body {
9191

9292
```
9393
94-
Content-Security-Policy: ...
94+
content-security-policy: ...
9595
script-src 'nonce-/jRAxuLJsDXAxqhNBB7gg7h55KETtDQBXe4ZL+xIXwI=' ...;
9696
style-src 'nonce-/jRAxuLJsDXAxqhNBB7gg7h55KETtDQBXe4ZL+xIXwI=' ...;
9797
```
@@ -118,13 +118,13 @@ You can clear the browser cache after the logout request by using the following.
118118

119119
``` ruby
120120
class ApplicationController < ActionController::Base
121-
# Configuration override to send the Clear-Site-Data header.
121+
# Configuration override to send the clear-site-data header.
122122
SecureHeaders::Configuration.override(:clear_browser_cache) do |config|
123123
config.clear_site_data = SecureHeaders::ClearSiteData::ALL_TYPES
124124
end
125125

126126

127-
# Clears the browser's cache for browsers supporting the Clear-Site-Data
127+
# Clears the browser's cache for browsers supporting the clear-site-data
128128
# header.
129129
#
130130
# Returns nothing.

docs/upgrading-to-4-0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The default CSP has changed to be more universal without sacrificing too much se
1515

1616
Previously, the default CSP was:
1717

18-
`Content-Security-Policy: default-src 'self'`
18+
`content-security-policy: default-src 'self'`
1919

2020
The new default policy is:
2121

lib/secure_headers/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def csp=(new_csp)
256256
end
257257
end
258258

259-
# Configures the Content-Security-Policy-Report-Only header. `new_csp` cannot
259+
# Configures the content-security-policy-report-only header. `new_csp` cannot
260260
# contain `report_only: false` or an error will be raised.
261261
#
262262
# NOTE: if csp has not been configured/has the default value when

lib/secure_headers/headers/clear_site_data.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module SecureHeaders
33
class ClearSiteDataConfigError < StandardError; end
44
class ClearSiteData
5-
HEADER_NAME = "Clear-Site-Data".freeze
5+
HEADER_NAME = "clear-site-data".freeze
66

77
# Valid `types`
88
CACHE = "cache".freeze
@@ -12,7 +12,7 @@ class ClearSiteData
1212
ALL_TYPES = [CACHE, COOKIES, STORAGE, EXECUTION_CONTEXTS]
1313

1414
class << self
15-
# Public: make an Clear-Site-Data header name, value pair
15+
# Public: make an clear-site-data header name, value pair
1616
#
1717
# Returns nil if not configured, returns header name and value if configured.
1818
def make_header(config = nil, user_agent = nil)
@@ -39,8 +39,8 @@ def validate_config!(config)
3939
end
4040
end
4141

42-
# Public: Transform a Clear-Site-Data config (an Array of Strings) into a
43-
# String that can be used as the value for the Clear-Site-Data header.
42+
# Public: Transform a clear-site-data config (an Array of Strings) into a
43+
# String that can be used as the value for the clear-site-data header.
4444
#
4545
# types - An Array of String of types of data to clear.
4646
#

lib/secure_headers/headers/content_security_policy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def initialize(config = nil)
2626
end
2727

2828
##
29-
# Returns the name to use for the header. Either "Content-Security-Policy" or
30-
# "Content-Security-Policy-Report-Only"
29+
# Returns the name to use for the header. Either "content-security-policy" or
30+
# "content-security-policy-report-only"
3131
def name
3232
@config.class.const_get(:HEADER_NAME)
3333
end

lib/secure_headers/headers/content_security_policy_config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def write_attribute(attr, value)
7878

7979
class ContentSecurityPolicyConfigError < StandardError; end
8080
class ContentSecurityPolicyConfig
81-
HEADER_NAME = "Content-Security-Policy".freeze
81+
HEADER_NAME = "content-security-policy".freeze
8282

8383
ATTRS = Set.new(PolicyManagement::ALL_DIRECTIVES + PolicyManagement::META_CONFIGS + PolicyManagement::NONCES)
8484
def self.attrs
@@ -107,7 +107,7 @@ def make_report_only
107107
end
108108

109109
class ContentSecurityPolicyReportOnlyConfig < ContentSecurityPolicyConfig
110-
HEADER_NAME = "Content-Security-Policy-Report-Only".freeze
110+
HEADER_NAME = "content-security-policy-report-only".freeze
111111

112112
def report_only?
113113
true

lib/secure_headers/headers/expect_certificate_transparency.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ module SecureHeaders
33
class ExpectCertificateTransparencyConfigError < StandardError; end
44

55
class ExpectCertificateTransparency
6-
HEADER_NAME = "Expect-CT".freeze
6+
HEADER_NAME = "expect-ct".freeze
77
INVALID_CONFIGURATION_ERROR = "config must be a hash.".freeze
88
INVALID_ENFORCE_VALUE_ERROR = "enforce must be a boolean".freeze
99
REQUIRED_MAX_AGE_ERROR = "max-age is a required directive.".freeze
1010
INVALID_MAX_AGE_ERROR = "max-age must be a number.".freeze
1111

1212
class << self
13-
# Public: Generate a Expect-CT header.
13+
# Public: Generate a expect-ct header.
1414
#
1515
# Returns nil if not configured, returns header name and value if
1616
# configured.

0 commit comments

Comments
 (0)