Limit Webpack dev server allowed CORS origins #11866
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🛠 Summary of changes
Updates local Webpack development server to limit allowed origins for CORS to the expected local web server origin (usually http://localhost:3000).
This is motivated by a security advisory GHSA-67mh-4wv8-2f99 which addresses a similar issue in a package that we don't use in the IdP.
The risk here is fairly minimal, since the dev server only serves files out of the
public/
directory.An original approach considered disabling CORS altogether. CORS is enabled because we specify the
crossorigin
attribute on script assets in local development, and we specify this attribute because it allows for better error messages in pages using React.js (see #6126).📜 Testing Plan
Verify in local development that there are no issues loading JavaScript. It should be pretty evident if JavaScript is not working, because the "Here's how you know" USA banner will display as expanded by default.