Skip to content

Commit

Permalink
Set stricter CSP header in redirect response
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed May 11, 2019
1 parent 8abdc49 commit ab7cc3c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
==========

* Set stricter CSP header in redirect response
* deps: [email protected]
- deps: range-parser@~1.2.1

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function createRedirectDirectoryListener () {
res.statusCode = 301
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
res.setHeader('Content-Length', Buffer.byteLength(doc))
res.setHeader('Content-Security-Policy', "default-src 'self'")
res.setHeader('Content-Security-Policy', "default-src 'none'")
res.setHeader('X-Content-Type-Options', 'nosniff')
res.setHeader('Location', loc)
res.end(doc)
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ describe('serveStatic()', function () {
it('should respond with default Content-Security-Policy', function (done) {
request(server)
.get('/users')
.expect('Content-Security-Policy', "default-src 'self'")
.expect('Content-Security-Policy', "default-src 'none'")
.expect(301, done)
})

Expand Down

0 comments on commit ab7cc3c

Please sign in to comment.