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): keep bare URLs and emails literal (no autolink rewrite)
Sergey Kozyrenko55335cccbee7
diff --git a/frontend/src/components/shared/editor-markdown.ts b/frontend/src/components/shared/editor-markdown.tsindex c6fc0946..53a53136 100644--- a/frontend/src/components/shared/editor-markdown.ts+++ b/frontend/src/components/shared/editor-markdown.ts@@ -15,15 +15,19 @@ const createFaithfulMarked = () => {instance.use({tokenizer: {- // marked's del + emphasis tokenizers fire on `~` and `_`, mangling literal prose: `~5~` becomes- // <del>, and `__init__`/`_word_` become <strong>/<em> (the delimiters are consumed and gone by- // serialize time, so no serialize-side escape can recover them). Keep real GFM `~~strike~~` and- // `*`/`**` emphasis (what the toolbar emits); neutralise a lone `~…~` and ALL `_`-delimited- // emphasis so that text — Python dunders, ranges, snake_case — round-trips verbatim.+ // These marked tokenizers auto-convert literal text into markup a serialize-side escape can't undo,+ // mangling Go-template / pentest prose on round-trip. Neutralise the lossy cases, keep what the+ // toolbar emits:+ // • del — keep GFM `~~strike~~`, drop a lone `~…~` (else `~5~` / ranges become <del>)+ // • emStrong — keep `*`/`**`, drop `_`-delimited emphasis (else `__init__`/`_word_` become em/strong)+ // • html/tag — keep `<xml-like>` tags literal (marked swallows real-HTML-element names)+ // • autolink/url — keep bare `https://…` / `<url>` / emails literal (marked wraps them in [](…))+ autolink: () => undefined,del: (src: string) => (/^~~(?!~)/.test(src) ? false : undefined),emStrong: (src: string) => (/^_/.test(src) ? undefined : false),html: () => undefined,tag: () => undefined,+ url: () => undefined,},});diff --git a/frontend/src/components/shared/markdown-editor-extensions.test.ts b/frontend/src/components/shared/markdown-editor-extensions.test.tsindex eba54c68..a00cae40 100644--- a/frontend/src/components/shared/markdown-editor-extensions.test.ts+++ b/frontend/src/components/shared/markdown-editor-extensions.test.ts@@ -95,6 +95,19 @@ describe('underscore delimiters stay literal — dunders/identifiers survive, *});});+describe('bare URLs and emails stay literal — explicit [links] still work', () => {+ it.each(['see https://example.com/path now', 'contact [email protected] today', 'a <https://example.com> ref'])(+ 'keeps %s byte-identical',+ (s) => {+ expect(roundTrip(s)).toBe(s);+ },+ );++ it('still round-trips an explicit [link](url)', () => {+ expect(roundTrip('[docs](https://example.com)')).toContain('[docs](https://example.com)');+ });+});+describe('inline marks round-trip', () => {it.each(['**bold**', '*italic*', '`code span`', '~~strike~~', '[a link](https://example.com)', '**bold `code` end**'])('preserves %s',