Repository navigation
Conversation
What was broken The Veterans community page rendered without its styles and client scripts, leaving unformatted content and oversized icons. Root cause The public CDN redirects static assets to community-app.topcoder.com, but that destination was absent from the community Content-Security-Policy script, style, font, and image source lists. What was changed Allow the configured community application's static-asset endpoint in those four directives and document the server setup behavior. Preserve the existing policy scope and other restrictions. Any added/updated tests Add eight middleware regression cases covering Veterans routes, the shared TCO policy, unrelated pages, and the CMS example frame policy. The six asset-policy cases failed before the fix and pass afterward. Validation: yarn lint, yarn test (477 passed, 23 already skipped; 141 snapshots passed), and yarn run build passed under Node 10.24.1. Desktop and mobile browser checks using the updated response policy restored the page styling and confirmed that static-asset redirects are no longer blocked by CSP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What was broken
Opening the Veterans community from Account Settings displayed unstyled content and oversized icons, as shown in PM-6583.
Root cause
The CDN redirects CSS, JavaScript, fonts, and bundled images to
https://community-app.topcoder.com/api/cdn/public/static-assets/. The community Content-Security-Policy permitted the CDN but blocked this redirect destination. Browser reproduction confirmed blocked main and Veterans stylesheets and application scripts; the assets themselves return HTTP 200.What was changed
src/server/index.js: allow the configured community application's static-asset endpoint in the existing script, style, font, and image directives; update the setup hook documentation.__tests__/server/community-csp.js: exercise the actual Express middleware with eight regression cases.The shared Veterans/TCO policy retains its existing route scope and other restrictions. No UI redesign or dependency changes are included.
Any added/updated tests
nvm useselected Node 10.24.1 before all Node/Yarn commands.yarn lint: passed.yarn test: passed — 171 suites, 477 tests, and 141 snapshots; 4 suites/23 tests remain skipped by the existing suite.yarn run build: passed, with dependency and bundle-size warnings.git diff --check: passed.Browser validation also exposed separate live-site errors involving an old CloudFront image hostname, the universal-navigation CORS response, a communities CSS chunk served as HTML, and a client
trackserror. Those are outside this narrowly scoped CSP correction.