Skip to content

feat(checkout): enforce embed hosts through frame-ancestors - #14234

Merged
maximevast merged 5 commits into
mainfrom
maxime/eng-12-enforce-frame-ancestors
Sep 10, 2026
Merged

maximevast merged 5 commits into
mainfrom
maxime/eng-12-enforce-frame-ancestors

Conversation

@maximevast

@maximevast maximevast commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Actual enforcement of for ENG-12.

To be merged later when we checked the logs for breaking framed page.

Behind a feature flag, safe to merge now #14349

Checklist

  • This PR addresses a single concern (one bug fix, one feature, one refactor)
  • The diff is reasonably sized and easy to review
  • New functionality is covered by tests
  • Linting and type checking pass (uv run task lint && uv run task lint_types)
  • No unrelated changes or drive-by fixes are included

Review in cubic

@mintlify

mintlify Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Polar 🟢 Ready View Preview Sep 7, 2026, 2:15 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@maximevast
maximevast removed the request for review from pieterbeulque September 7, 2026 14:14
@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
orbit Ready Ready Preview Sep 10, 2026 3:08pm UTC
polar-test Ready Ready Preview Sep 10, 2026 3:08pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Enforces checkout embed allowlist via frame-ancestors CSP and X-Frame-Options; author explicitly says to merge later after log checks, and the change may break existing embeds not on the allowlist.

Re-trigger cubic

const checkout = request.nextUrl.pathname.match(CHECKOUT_CLIENT_SECRET)
if (checkout) {
const frameAncestors = isFramed(request)
? await getFrameAncestors(request, checkout[1])

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.

Follow-up improvement: I would be okay if we simply add a property embed_policy directly in the CheckoutPublic object. Would avoid an extra request.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We would avoid 1 extra endpoint, not the extra request, the proxy needs to know the policy before we renders the page.

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.

Of course, bad idea then :p

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder what the impact will be on our TTFB for a checkout in production

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It adds ~20ms server side, but only for framed checkout (~15% of all checkouts since yesterday)

Comment thread clients/apps/web/src/proxy.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Enforces checkout embed allowlist via frame-ancestors CSP; feature flag claim not visible in diff, and enforcement may break existing embedders not on the allowlist.

Re-trigger cubic

@maximevast
maximevast added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit f8f052e Sep 10, 2026
27 of 28 checks passed
@maximevast
maximevast deleted the maxime/eng-12-enforce-frame-ancestors branch September 10, 2026 15:17

This branch was successfully deployed

3 active (1 outdated) deployments
Preview – polar-test — 2fd64596 Deployed Sep 10, 2026 by vercel[bot]
Preview – orbit — 2fd64596 Deployed Sep 10, 2026 by vercel[bot]
staging - docs — 6093f6e8 Deployed Sep 7, 2026 by mintlify[bot]
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.

3 participants