-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/docs-basic-entries
- Loading branch information
Showing
12 changed files
with
183 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Cache-Control | ||
nav_order: 7 | ||
parent: Configuration | ||
layout: page | ||
--- | ||
|
||
The Mozilla Developer Network describes the Cache-Control header like this: | ||
|
||
{: .quote } | ||
> The HTTP Cache-Control header holds directives (instructions) in both requests and responses that control caching in browsers and shared caches (e.g., Proxies, CDNs). | ||
> | ||
> source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control | ||
A Cache-Control header can be added in one of two ways, either using the default middleware options: | ||
|
||
```csharp | ||
app.UseSecureHeadersMiddleware(); | ||
``` | ||
|
||
The above adds the Cache-Control header with a `no-store, max-age=0` value. | ||
|
||
Or by creating an instance of the `SecureHeadersMiddlewareBuilder` class using the following code: | ||
|
||
```csharp | ||
var customConfig = SecureHeadersMiddlewareBuilder | ||
.CreateBuilder() | ||
.UseCacheControl() | ||
.Build(); | ||
|
||
app.UseSecureHeadersMiddleware(customConfig); | ||
``` | ||
|
||
The above adds the Cache-Control header with a `no-store, max-age=0` value. | ||
|
||
## Full Options | ||
|
||
The Cache-Control header object (known internally as `CacheControl`) has the following options: | ||
|
||
- bool: `Private` | ||
- int: `MaxAge` | ||
- bool: `NoCache` | ||
- bool: `MustReevaluate` | ||
- bool: `NoStore` | ||
|
||
These values can be set when creating a new instance of the `ReferrerPolicyOptions` object, or by calling the `UseCacheControl` extension method on the `SecureHeadersMiddlewareConfiguration` class. | ||
|
||
{: .warning } | ||
> It's worth noting that the default values for this header mean that no content will be cached in the browser. You may need to evaluate this default value on a case-by-case basis. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Content-Security-Policy | ||
nav_order: 5 | ||
nav_order: 4 | ||
parent: Configuration | ||
layout: page | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: Referrer-Policy | ||
nav_order: 6 | ||
parent: Configuration | ||
layout: page | ||
--- | ||
|
||
The Mozilla Developer Network describes the Referrer-Policy header like this: | ||
|
||
{: .quote } | ||
> The HTTP Referrer-Policy response header controls how much referrer information (sent with the Referer header) should be included with requests. | ||
> | ||
> source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy | ||
A Referrer-Policy header can be added in one of two ways, either using the default middleware options: | ||
|
||
```csharp | ||
app.UseSecureHeadersMiddleware(); | ||
``` | ||
|
||
The above adds the Referrer-Policy header with a `no-referrer` value. | ||
|
||
Or by creating an instance of the `SecureHeadersMiddlewareBuilder` class using the following code: | ||
|
||
```csharp | ||
var customConfig = SecureHeadersMiddlewareBuilder | ||
.CreateBuilder() | ||
.UseReferrerPolicy() | ||
.Build(); | ||
|
||
app.UseSecureHeadersMiddleware(customConfig); | ||
``` | ||
|
||
The above adds the Referrer-Policy header with a `no-referrer` value. | ||
|
||
## Full Options | ||
|
||
The Referrer-Policy header object (known internally as `ReferrerPolicy`) has the following options: | ||
|
||
- enum: `ReferrerPolicyOptions` | ||
|
||
The values available for the `ReferrerPolicyOptions` enum are: | ||
|
||
- `noReferrer` | ||
- `noReferrerWhenDowngrade` | ||
- `origin` | ||
- `originWhenCrossOrigin` | ||
- `sameOrigin` | ||
- `strictOrigin` | ||
- `strictWhenCrossOrigin` | ||
- `unsafeUrl` | ||
|
||
These values can be set when creating a new instance of the `ReferrerPolicyOptions` object, or by calling the `UseReferrerPolicy` extension method on the `SecureHeadersMiddlewareConfiguration` class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: X-Permitted-Cross-Domain-Policies | ||
nav_order: 5 | ||
parent: Configuration | ||
layout: page | ||
--- | ||
|
||
The Mozilla Developer Network describes the X-Permitted-Cross-Domain-Policies header like this: | ||
|
||
{: .quote } | ||
> Specifies if a cross-domain policy file (crossdomain.xml) is allowed. The file may define a policy to grant clients, such as Adobe's Flash Player (now obsolete), Adobe Acrobat, Microsoft Silverlight (now obsolete), or Apache Flex, permission to handle data across domains that would otherwise be restricted due to the Same-Origin Policy. | ||
> | ||
> source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers | ||
{: .note} | ||
> It is worth noting that the X-Permitted-Cross-Domain-Policies header was originally created when browsers would make use of Adobe's Flash Player, Adobe Acrobat, Microsoft Silverlight, or Apache Flex and that two of those technologies are now obsolete. | ||
> | ||
> Whilst those technologies are obsolete, it's still worth having this header present as a "belt-and-braces" check against any future vulnerabilities which might mask themselves as any of the obsolete technologies it was invented to protect. | ||
An X-Permitted-Cross-Domain-Policies header can be added in one of two ways, either using the default middleware options: | ||
|
||
```csharp | ||
app.UseSecureHeadersMiddleware(); | ||
``` | ||
|
||
The above adds the X-Permitted-Cross-Domain-Policies header with a `none` value. | ||
|
||
Or by creating an instance of the `SecureHeadersMiddlewareBuilder` class using the following code: | ||
|
||
```csharp | ||
var customConfig = SecureHeadersMiddlewareBuilder | ||
.CreateBuilder() | ||
.UsePermittedCrossDomainPolicies() | ||
.Build(); | ||
|
||
app.UseSecureHeadersMiddleware(customConfig); | ||
``` | ||
|
||
The above adds the X-Permitted-Cross-Domain-Policies header with a `none` value. | ||
|
||
## Full Options | ||
|
||
The X-Permitted-Cross-Domain-Policies header object (known internally as `PermittedCrossDomainPolicyConfiguration`) has the following options: | ||
|
||
- enum: `XPermittedCrossDomainOptionValue` | ||
|
||
The values available for the `XPermittedCrossDomainOptionValue` enum are: | ||
|
||
- `none` | ||
- `masterOnly` | ||
- `byContentType` | ||
- `byFtpFileType` | ||
- `all` | ||
|
||
These values can be set when creating a new instance of the `XPermittedCrossDomainOptionValue` object, or by calling the `UsePermittedCrossDomainPolicies` extension method on the `SecureHeadersMiddlewareConfiguration` class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters