-
Notifications
You must be signed in to change notification settings - Fork 1
Create automation for easier to read CSP diffs #1210
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
Conversation
64d2f65 to
c0807ce
Compare
Deploying blog-site with
|
| Latest commit: |
1408ea1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://027f68f3.blog-site-602.pages.dev |
| Branch Preview URL: | https://dallas-automate-headers.blog-site-602.pages.dev |
c3c7976 to
9d571f3
Compare
bin/_headers.config.ts
Outdated
| 'Content-Security-Policy': { | ||
| // Allow AJAX/fetch requests to status page, marketing site, HubSpot, and Google services | ||
| 'connect-src': [ | ||
| '\'self\'', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are still escaped
bin/_headers.config.ts
Outdated
| pattern: '/*', | ||
| headers: { | ||
| 'Content-Security-Policy': { | ||
| // Allow AJAX/fetch requests to status page, marketing site, HubSpot, and Google services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Allow AJAX/fetch requests to status page, marketing site, HubSpot, and Google services |
bin/_headers.config.ts
Outdated
| 'https://www.maxmind.com', | ||
| // HubSpot API endpoint | ||
| // https://legacydocs.hubspot.com/docs/faq/how-do-i-create-a-custom-domain-for-my-forms | ||
| 'https://api.hubspot.com', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The placement of comments is confusing; hubspot + google comments are grouped together but they each need to be adjacent to the relevant url(s).
| for (const [ | ||
| header, | ||
| value, | ||
| ] of Object.entries(pathConfig.headers)) { | ||
| if (typeof value === 'object' && !Array.isArray(value)) { | ||
| // CSP-style header with directives | ||
| const directives: string[] = []; | ||
| for (const [ | ||
| directive, | ||
| sources, | ||
| ] of Object.entries(value)) { | ||
| directives.push(`${directive} ${sources.join(' ')}`); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is weird
| /** | ||
| * Generate _headers file content from config | ||
| */ | ||
| function generateHeaders(config: { paths: PathConfig[] }): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not generating the expected output. It's not outputting the proper delimiters (ie ; or ,) for non-CSP values.
| 'Referrer-Policy': [ | ||
| 'strict-origin-when-cross-origin', | ||
| ], | ||
| 'Strict-Transport-Security': [ | ||
| 'max-age=63072000', | ||
| 'includeSubDomains', | ||
| 'preload', | ||
| ], | ||
| 'X-Content-Type-Options': [ | ||
| 'nosniff', | ||
| ], | ||
| 'X-Frame-Options': [ | ||
| 'DENY', | ||
| ], | ||
| 'X-XSS-Protection': [ | ||
| '1', | ||
| 'mode=block', | ||
| ], | ||
| }, | ||
| }, | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is weird
c447250 to
1408ea1
Compare
No description provided.