Skip to content

Commit 18e1ed3

Browse files
committed
Add default stubs for Content-Security-Policy
1 parent 55c0a90 commit 18e1ed3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

middleware/policy.es

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const
2+
23
policies = [
3-
`default-src 'none';`
4+
`default-src 'none';` // `default-src 'self' https://${domain};`
45
]
56

7+
68
module.exports = options =>
79

810
async (context, next) => {

middleware/policy.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ test ("Content-Security-Policy: default-src 'none';", async t => {
2323
})
2424

2525

26-
test ("Content-Security-Policy: script-src 'self';")
26+
test ("Content-Security-Policy: frame-src 'self';")
27+
test ("Content-Security-Policy: style-src 'self';")
2728
test ("Content-Security-Policy: img-src 'self' https://cdn.example.com;")
29+
test ("Content-Security-Policy: script-src 'self';")
2830
test ("Content-Security-Policy: connect-src 'self';")
31+
test ("Content-Security-Policy: report-uri 'self';")

0 commit comments

Comments
 (0)