-
Couldn't load subscription status.
- Fork 50
Fixed : added specific headers (#379) #668
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Nirvan-Bobde30, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the security configuration of the application by updating the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request aims to improve security by adding and updating HTTP headers in firebase.json. The changes include adding X-Content-Type-Options, enabling HSTS preloading, and updating the Content-Security-Policy (CSP). While these are positive changes, I've found a critical syntax error in the CSP that could render it ineffective. I've also highlighted a potentially breaking change in the connect-src directive. Additionally, please note that the header configurations are duplicated across the prod, dev, and uat environments, which increases the maintenance effort and risk of inconsistencies. Careful attention is needed when updating these configurations in the future.
firebase.json
Outdated
| { | ||
| "key": "Content-Security-Policy", | ||
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self' *" | ||
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.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.
There are a couple of issues with the new Content-Security-Policy value:
- Invalid Syntax: The policy string ends with
; *, which is invalid syntax. This will likely cause browsers to reject the entire CSP header, leaving the application unprotected. The trailing; *should be removed. - Potentially Breaking
connect-srcChange: Theconnect-srcdirective was changed from the very permissive'self' *to the very restrictive'self'. This is a good security practice, but it will break any functionality that relies on making requests to third-party APIs. If such functionality exists, the required domains must be added to theconnect-srcdirective.
Here is a suggested correction for the syntax issue. You may need to further adjust connect-src based on your application's needs.
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.com; *" | |
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.com" |
firebase.json
Outdated
| { | ||
| "key": "Content-Security-Policy", | ||
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self' *" | ||
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.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.
There are a couple of issues with the new Content-Security-Policy value:
- Invalid Syntax: The policy string ends with
; *, which is invalid syntax. This will likely cause browsers to reject the entire CSP header, leaving the application unprotected. The trailing; *should be removed. - Potentially Breaking
connect-srcChange: Theconnect-srcdirective was changed from the very permissive'self' *to the very restrictive'self'. This is a good security practice, but it will break any functionality that relies on making requests to third-party APIs. If such functionality exists, the required domains must be added to theconnect-srcdirective.
Here is a suggested correction for the syntax issue. You may need to further adjust connect-src based on your application's needs.
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.com; *" | |
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.com" |
firebase.json
Outdated
| { | ||
| "key": "Content-Security-Policy", | ||
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self' *" | ||
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.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.
There are a couple of issues with the new Content-Security-Policy value:
- Invalid Syntax: The policy string ends with
; *, which is invalid syntax. This will likely cause browsers to reject the entire CSP header, leaving the application unprotected. The trailing; *should be removed. - Potentially Breaking
connect-srcChange: Theconnect-srcdirective was changed from the very permissive'self' *to the very restrictive'self'. This is a good security practice, but it will break any functionality that relies on making requests to third-party APIs. If such functionality exists, the required domains must be added to theconnect-srcdirective.
Here is a suggested correction for the syntax issue. You may need to further adjust connect-src based on your application's needs.
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.com; *" | |
| "value": "default-src 'self';font-src 'self' data: *;script-src 'self' 'unsafe-inline' 'unsafe-eval' fonts.googleapis.com https://www.gstatic.com *.firebaseapp.com;img-src 'self' 'unsafe-inline' *.shopify.com javascript: ;style-src 'self' 'unsafe-inline' *;connect-src 'self'; frame-ancestors https://admin.shopify.com https://*.myshopify.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.
fixed
Related Issues
hotwax/dxp-components#397
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance