fix: Sanitize url missing in editor embeds and widgets
This commit is contained in:
@@ -5,6 +5,7 @@ import * as React from "react";
|
|||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { Optional } from "utility-types";
|
import { Optional } from "utility-types";
|
||||||
import { s } from "../../styles";
|
import { s } from "../../styles";
|
||||||
|
import { sanitizeUrl } from "../../utils/urls";
|
||||||
|
|
||||||
type Props = Omit<Optional<HTMLIFrameElement>, "children"> & {
|
type Props = Omit<Optional<HTMLIFrameElement>, "children"> & {
|
||||||
src?: string;
|
src?: string;
|
||||||
@@ -81,7 +82,7 @@ class Frame extends React.Component<PropsWithRef> {
|
|||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
title="embed"
|
title="embed"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
src={src}
|
src={sanitizeUrl(src)}
|
||||||
referrerPolicy={referrerPolicy}
|
referrerPolicy={referrerPolicy}
|
||||||
allowFullScreen
|
allowFullScreen
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import styled, { css, DefaultTheme, ThemeProps } from "styled-components";
|
import styled, { css, DefaultTheme, ThemeProps } from "styled-components";
|
||||||
import { s } from "../../styles";
|
import { s } from "../../styles";
|
||||||
|
import { sanitizeUrl } from "../../utils/urls";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
@@ -18,7 +19,7 @@ export default function Widget(props: Props & ThemeProps<DefaultTheme>) {
|
|||||||
className={
|
className={
|
||||||
props.isSelected ? "ProseMirror-selectednode widget" : "widget"
|
props.isSelected ? "ProseMirror-selectednode widget" : "widget"
|
||||||
}
|
}
|
||||||
href={props.href}
|
href={sanitizeUrl(props.href)}
|
||||||
rel="noreferrer nofollow"
|
rel="noreferrer nofollow"
|
||||||
onMouseDown={props.onMouseDown}
|
onMouseDown={props.onMouseDown}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user