Skip to content

test(pdc-frontend): clear STRAPI_PUBLIC_URL in production CSP test to prevent http: leak from dev .env#1493

Open
AliKdhim87 wants to merge 1 commit into
mainfrom
fix-the-csp-test-locally
Open

test(pdc-frontend): clear STRAPI_PUBLIC_URL in production CSP test to prevent http: leak from dev .env#1493
AliKdhim87 wants to merge 1 commit into
mainfrom
fix-the-csp-test-locally

Conversation

@AliKdhim87

Copy link
Copy Markdown
Collaborator

No description provided.

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cms-frameless-io Ready Ready Preview, Comment Jun 8, 2026 12:10pm
strapi-overige-objecten-api Ready Ready Preview, Comment Jun 8, 2026 12:10pm
strapi-pdc-frontend Ready Ready Preview, Comment Jun 8, 2026 12:10pm

Request Review

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

beforeEach(async () => {
process.env.OPEN_FORMS_API_URL = 'https://openforms.example.com';
delete process.env.STRAPI_PUBLIC_URL;
jest.resetModules();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kun je uitleggen wat het probleem is?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De jest.config.ts gebruikt nextJest, dat automatisch het .env-bestand inleest. Daardoor wordt STRAPI_PUBLIC_URL=http://localhost:1337/ toegevoegd aan de testomgeving.

De CSP-test voor productie laadt daarna opnieuw cspConfig.ts in, terwijl die HTTP-URL nog steeds is ingesteld. Die URL komt uiteindelijk terecht in frame-ancestors.

Dit is alleen lokaal een probleem. De test faalt omdat de productietest een https-URL verwacht, en geen http-URL.

@AliKdhim87 AliKdhim87 requested a review from Robbert June 16, 2026 08:57
Base automatically changed from development-strapi-v5 to main July 2, 2026 12:41
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.

2 participants