Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(figma): Incomplete URL substring sanitization

tzhangchi2f17534394b3
diff --git a/libs/components/editor-blocks/src/blocks/figma/index.ts b/libs/components/editor-blocks/src/blocks/figma/index.ts
index b3e0b76b8d..3ed44c9c85 100644
--- a/libs/components/editor-blocks/src/blocks/figma/index.ts
+++ b/libs/components/editor-blocks/src/blocks/figma/index.ts
@@ -1,9 +1,9 @@
+import { Protocol } from '@toeverything/datasource/db-service';
import {
AsyncBlock,
BaseView,
SelectBlock,
} from '@toeverything/framework/virgo';
-import { Protocol, services } from '@toeverything/datasource/db-service';
import { FigmaView } from './FigmaView';
export class FigmaBlock extends BaseView {
@@ -19,7 +19,10 @@ export class FigmaBlock extends BaseView {
const tag_name = el.tagName;
if (tag_name === 'A' && el.parentElement?.childElementCount === 1) {
const href = el.getAttribute('href');
- if (href.indexOf('.figma.com') !== -1) {
+ const allowedHosts = ['www.figma.com'];
+ const host = new URL(href).host;
+
+ if (allowedHosts.includes(host)) {
return [
{
type: this.type,