Skip to content

Commit

Permalink
Add CSP for development (bitwarden#1431)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton authored Feb 3, 2022
1 parent 596c3e8 commit 5c764a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@import "~bootstrap/scss/_print";

@import "~ngx-toastr/toastr";
@import "~sweetalert2/src/sweetalert2.scss";
@import "~#sweetalert2";

@import "./base";
@import "./buttons";
Expand Down
11 changes: 11 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ const devServer =
changeOrigin: true,
},
},
headers: [
{
key: "Content-Security-Policy",
value:
"default-src 'self'; script-src 'self' 'sha256-ryoU+5+IUZTuUyTElqkrQGBJXr1brEv6r2CA62WUw8w=' https://js.stripe.com https://js.braintreegateway.com https://www.paypalobjects.com; style-src 'self' https://assets.braintreegateway.com https://*.paypal.com 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' 'sha256-JVRXyYPueLWdwGwY9m/7u4QlZ1xeQdqUj2t8OVIzZE4='; img-src 'self' data: https://icons.bitwarden.net https://*.paypal.com https://www.paypalobjects.com https://q.stripe.com https://haveibeenpwned.com https://www.gravatar.com; child-src 'self' https://js.stripe.com https://assets.braintreegateway.com https://*.paypal.com https://*.duosecurity.com; frame-src 'self' https://js.stripe.com https://assets.braintreegateway.com https://*.paypal.com https://*.duosecurity.com; connect-src 'self' wss://notifications.bitwarden.com https://notifications.bitwarden.com https://cdn.bitwarden.net https://api.pwnedpasswords.com https://2fa.directory/api/v2/totp.json https://2fa.directory/api/v3/totp.json https://api.stripe.com https://www.paypal.com https://api.braintreegateway.com https://client-analytics.braintreegateway.com https://*.braintree-api.com https://bitwardenxx5keu3w.blob.core.windows.net; object-src 'self' blob:;",
},
],
hot: false,
allowedHosts: envConfig.dev?.allowedHosts ?? "auto",
client: {
Expand Down Expand Up @@ -240,6 +247,10 @@ const webpackConfig = {
extensions: [".ts", ".js"],
symlinks: false,
modules: [path.resolve("node_modules")],
alias: {
sweetalert2: require.resolve("sweetalert2/dist/sweetalert2.js"),
"#sweetalert2": require.resolve("sweetalert2/src/sweetalert2.scss"),
},
fallback: {
buffer: false,
util: require.resolve("util/"),
Expand Down

0 comments on commit 5c764a9

Please sign in to comment.