Skip to content

Security hardening: YMetrika and Embed #126

@tmshv

Description

@tmshv

Problems

  1. dangerouslySetInnerHTML in YMetrikasrc/components/YMetrika/index.tsx
    Script string is built via template literal interpolation. Migrate to Next.js <Script> component with strategy="afterInteractive". Remove HTML comments from inside the script body.

  2. Iframe Embed without sandboxsrc/components/Embed/index.tsx:17-23
    <iframe> renders arbitrary src from MDX without restrictions. Add security attributes:

    <iframe
      src={props.src}
      sandbox="allow-scripts allow-same-origin"
      loading="lazy"
      style={{ border: 'none' }}
    />

    Also remove deprecated frameBorder attribute.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions