Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove deprecated CSP: prefetch-src option #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion __tests__/buildCSPHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const DEFAULT_CSP = {
'manifest-src': '\'self\'',
'media-src': '\'self\'',
'object-src': '\'none\'',
'prefetch-src': '\'self\'',
'script-src': '\'self\'',
'style-src': '\'self\'',
'worker-src': '\'self\'',
Expand Down
11 changes: 0 additions & 11 deletions docs/api/contentSecurityPolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"manifest-src": "'self'",
"media-src": "'self'",
"object-src": "'none'",
"prefetch-src": "'self'",
"script-src": "'self'",
"style-src": "'self'",
"worker-src": "'self'",
Expand Down Expand Up @@ -83,16 +82,6 @@ Note that `'self'` is in quotes. This is a CSP thing and `next-safe` does not ha
}
```

#### Disable the `prefetch-src` directive

```js
{
contentSecurityPolicy: {
"prefetch-src": false,
},
}
```

#### Disable CSP entirely (NOT recommended)

```js
Expand Down
1 change: 0 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ nextSafe({
"manifest-src": "'self'",
"media-src": "'self'",
"object-src": "'none'",
"prefetch-src": "'self'",
"script-src": "'self'",
"style-src": "'self'",
"worker-src": "'self'",
Expand Down
1 change: 0 additions & 1 deletion lib/buildCSPHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ module.exports = function buildCSPHeaders(options = {}) {
'manifest-src': getCSPDirective(contentSecurityPolicy['manifest-src'], "'self'", mergeDefaultDirectives),
'media-src': getCSPDirective(contentSecurityPolicy['media-src'], "'self'", mergeDefaultDirectives),
'object-src': getCSPDirective(contentSecurityPolicy['object-src'], "'none'", mergeDefaultDirectives),
'prefetch-src': getCSPDirective(contentSecurityPolicy['prefetch-src'], "'self'", mergeDefaultDirectives),
'script-src': getCSPDirective(contentSecurityPolicy['script-src'], "'self'", mergeDefaultDirectives),
'style-src': getCSPDirective(contentSecurityPolicy['style-src'], "'self'", mergeDefaultDirectives),
'worker-src': getCSPDirective(contentSecurityPolicy['worker-src'], "'self'", mergeDefaultDirectives),
Expand Down
1 change: 0 additions & 1 deletion lib/models/CSP.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* @property {CSPDirective} ['manifest-src']
* @property {CSPDirective} ['media-src']
* @property {CSPDirective} ['object-src']
* @property {CSPDirective} ['prefetch-src']
* @property {CSPDirective} ['script-src']
* @property {CSPDirective} ['style-src']
* @property {CSPDirective} ['worker-src']
Expand Down