Skip to content

Commit

Permalink
Merge pull request #1429 from kethinov/0.22.13
Browse files Browse the repository at this point in the history
0.22.13
  • Loading branch information
kethinov authored Jun 9, 2024
2 parents c70d8de + c29bbb8 commit f3802a5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Put your changes here...

## 0.22.13

- Altered helmet's defaults again. The `form-action` directive has been set to `null`. This makes it possible to submit forms to other domains in production mode.

## 0.22.12

- Added `'unsafe-inline'` option to helmet's `Content-Security-Policy`'s `script-src` directive by default in Roosevelt. This will prevent inline scripts from being blocked in production mode.
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,11 @@ Resolves to:
- `helmet`: Parameters to pass to the [helmet](https://github.com/helmetjs/helmet) module. This module helps secure Express apps by setting HTTP response headers.
- Default: *[Object]* The default options are specified in the [helmet docs](https://helmetjs.github.io/), with the following exceptions:
- The `upgrade-insecure-requests` option that helmet sets in the `Content-Security-Policy` has been removed by default in Roosevelt.
- The `'unsafe-inline'` option has been added to the `Content-Security-Policy`'s `script-src` directive by default in Roosevelt.
- Default: *[Object]* The default options are specified in the [helmet docs](https://helmetjs.github.io/), with the following exceptions that Roosevelt makes to the default `Content-Security-Policy` settings:
- The `upgrade-insecure-requests` directive has been removed. This change prevents [this bug](https://github.com/rooseveltframework/roosevelt/issues/964).
- The `script-src` directive has been set to `'unsafe-inline'`. This makes it possible to use inline scripts.
- The `form-action` directive has been set to `null`. This makes it possible to submit forms to other domains.
- You can reverse any of these changes by configuring helmet yourself.
- `logging`: Parameters to pass to [roosevelt-logger](https://github.com/rooseveltframework/roosevelt-logger). See [roosevelt-logger parameters documentation](https://github.com/rooseveltframework/roosevelt-logger#configure-logger) for configuration options.
Expand Down
5 changes: 3 additions & 2 deletions lib/setExpressConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ module.exports = function (app) {
if (contentSecurityPolicy === undefined) {
contentSecurityPolicy = {}
contentSecurityPolicy.directives = helmet.contentSecurityPolicy.getDefaultDirectives()
delete contentSecurityPolicy.directives['upgrade-insecure-requests']
contentSecurityPolicy.directives['script-src'].push('\'unsafe-inline\'')
delete contentSecurityPolicy.directives['upgrade-insecure-requests'] // fixes https://github.com/rooseveltframework/roosevelt/issues/964
contentSecurityPolicy.directives['script-src'].push('\'unsafe-inline\'') // allow inline script tags
contentSecurityPolicy.directives['form-action'] = null // allow submitting to forms on other domains
}
app.use(helmet({ ...params.helmet, contentSecurityPolicy }))
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/rooseveltframework/roosevelt/graphs/contributors"
}
],
"version": "0.22.12",
"version": "0.22.13",
"files": [
"defaultErrorPages",
"lib",
Expand Down

0 comments on commit f3802a5

Please sign in to comment.