electrode-io / electrode

Web applications with node.js and React
Other
2.1k stars 300 forks source link

fix: csp header with subapp v1 #1959

Closed arunvishnun closed 1 year ago

arunvishnun commented 1 year ago

Summary

This is an extension to https://github.com/electrode-io/electrode/pull/1958 and enforce CSP nonce for style tags Ini addition, changes made to provide provision for users to selectively set/unset CSP for scripts and styles.

To set CSP header app has three options

  1. App can pass a generated nonce value through cspNonce route option
  2. Set cspNonce flag. This would be boolean. By default cspNonce flag is set false. Electrode will generate once and set CSP header.
  3. Selectively set boolean flag for scripts and styles. Setting cspNonce: { style: true } will add nonce only for styles

Additional changes /notes

Changelogs added