Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
fix(editor): validate image src protocol before insert (defense-in-depth)
Sergey Kozyrenkod652585e3622
diff --git a/frontend/src/components/shared/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor.tsxindex 6e02523c..872bb87f 100644--- a/frontend/src/components/shared/markdown-editor.tsx+++ b/frontend/src/components/shared/markdown-editor.tsx@@ -297,6 +297,18 @@ function MarkdownEditor({);}+// The Image extension (unlike Link) doesn't validate the src protocol, so reject non-http(s)/non-image-data+// URLs (javascript:, data:text/html, …) before they're stored — defense-in-depth for saved content.+const isSafeImageSrc = (url: string): boolean => {+ try {+ const { protocol } = new URL(url, window.location.href);++ return protocol === 'http:' || protocol === 'https:' || /^data:image\//i.test(url);+ } catch {+ return false;+ }+};+function MarkdownEditorToolbar({ disabled, editor }: MarkdownEditorToolbarProps) {const handleSetLink = useCallback(() => {const previousUrl = editor.getAttributes('link').href as string | undefined;@@ -463,7 +475,7 @@ function MarkdownEditorToolbar({ disabled, editor }: MarkdownEditorToolbarProps)onPressedChange={() => {const url = window.prompt('Image URL');- if (url) {+ if (url && isSafeImageSrc(url)) {editor.chain().focus().setImage({ src: url }).run();}}}