Skip to content

PM-6583: Restore Veterans community asset loading - #7289

Merged
jmgasper merged 1 commit into
developfrom
PM-6583
Oct 19, 2026
Merged

jmgasper merged 1 commit into
developfrom
PM-6583

Conversation

@jmgasper

Copy link
Copy Markdown
Collaborator

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

  • Six asset-policy cases cover Veterans home/learn pages, community-prefixed routes, and the shared TCO policy. These failed before the fix and pass afterward.
  • Two cases preserve unrelated-page behavior and the CMS example frame policy.
  • nvm use selected 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.
  • Chromium desktop (1280px) and mobile (390px): reproduced the unstyled live page, then applied the CSP emitted by the modified middleware to the live response. Navigation, hero banners, content sections, and blog cards render with their existing styling; main/Veterans CSS loads and static-asset redirects are no longer blocked by CSP. This is a local response-header override, not a production deployment.

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 tracks error. Those are outside this narrowly scoped CSP correction.

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.
@jmgasper
jmgasper requested a review from kkartunov as a code owner October 19, 2026 01:15
@jmgasper
jmgasper merged commit 24e0ceb into develop Oct 19, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

1 participant