Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 8+ ready #105

Open
4 of 9 tasks
pahlers opened this issue Jan 13, 2022 · 4 comments
Open
4 of 9 tasks

Angular 8+ ready #105

pahlers opened this issue Jan 13, 2022 · 4 comments

Comments

@pahlers
Copy link

pahlers commented Jan 13, 2022

Description

The CspHtmlWebpackPlugin is a plugin made for Webpack, but doesn't integrate with the Angular build process anymore. Since Angular 8+ will generate the index.html outside the Webpack build process. You need to use the indexTransform parameter of @angular-builders/custom-webpack to do this.

I wrote the code to do this. This code is already being used in production. But I think that it would be nicer when this code is incorporated into this project, so maintaining and testing is more easier.

You can find an example project on https://gitlab.flusso.nl/public-projects/angular-csp-html-transform-example.

I like to help / code this solution, but would like a direction how to do this.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
@melloware
Copy link

I am interested in helping you implement this in my fork: https://github.com/melloware/csp-webpack-plugin

I have added more functionality to this core plug-in. Open a ticket on my project and we can work together to get it implemented.

@pahlers
Copy link
Author

pahlers commented Apr 1, 2022

@melloware Let see what we can do. I have my "hackware" used by a client. I did also added some more features. I will update my example code. Let's compare and make a plan! A-team tune starts

@melloware
Copy link

I like it!

@pahlers
Copy link
Author

pahlers commented Apr 1, 2022

I added the following feature. All the code is already in the project.

Inline CSP, using the meta-tag, doesn't support sending violation reports to a server.

For that reason my example project is adding a way to generate server configuration files. And it supports adding the headers to allow CSP header during development. I hope this fast feedback loop helps the developer writing a better application.

My suggestion is to split the code in two parts.

  1. A library that calculates, checks and generates the CSP based on the configuration.
  2. Tools which uses the CSP to generate the server configuration, CSP meta-tag, include the headers during development, etc.

I would like to have a library because a big part of my tools can't use the webpack plugin. Like this ticket says the render of the index.html isn't done by webpack.

Also it allows others developers to write tools for Rollup, Parcell, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants