Skip to content

Conversation

@dcshzj
Copy link
Contributor

@dcshzj dcshzj commented Dec 4, 2025

Problem

The referrerpolicy attribute is being stripped, but is required by YouTube.

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
  • No - this PR is backwards compatible with ALL of the following feature flags in this doc

Bug Fixes:

  • Add referrerpolicy as a whitelisted attribute.

Tests

  • Edit any page using the markdown editor and paste the YouTube embed.
  • Verify that the preview works correctly.
  • Save the page, verify that the preview continues to work with the YouTube embed.

Copilot AI review requested due to automatic review settings December 4, 2025 09:21
Copilot finished reviewing on behalf of dcshzj December 4, 2025 09:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the referrerpolicy attribute was being stripped from YouTube embeds by DOMPurify, preventing proper functionality of embedded YouTube videos.

Key Changes:

  • Added referrerpolicy to the DOMPurify ADD_ATTR allowlist to support YouTube embed requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"marginwidth",
"target",
"async",
"referrerpolicy",
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The addition of referrerpolicy to the allowed attributes list lacks test coverage. Consider adding a test case that verifies YouTube embeds with the referrerpolicy attribute are properly sanitized and the attribute is preserved. Other services in the same directory (e.g., RateLimiter.spec.ts, MailClient.spec.ts) have test coverage in the __tests__ directory.

Copilot uses AI. Check for mistakes.
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