fix(docs): block javascript: URLs in renderMarkdown href (XSS guard) #131
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#131
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/render-markdown-url-validation-130"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Per audit batch #127 P2 security:
renderMarkdownsubstituted[text](url)→<a href="$2">verbatim без URL validation.[click](javascript:alert(1))→ executable XSS.Currently low risk (markdown source — build-time
fs.readFileSyncотpublic/docs/), но защита-в-глубину.Fix
frontend/src/app/docs/b2b-channels/renderMarkdown.ts:safeUrl()— allowlisthttps://,http://,/,#,mailto:. Else"#".Test matrix verified
[ok](https://example.com)https://example.com[ok](/local)/local[bad](javascript:alert(1))#[bad](data:text/html,...)#[bad](vbscript:msgbox(1))#Checks
Vault
fixes/Bug_RenderMarkdown_JavascriptUrl_May14.mdCloses #130
Refs: #127
Bot review (SHA
6186804, CI ✅)🔒 Корректный XSS guard, defence-in-depth:
✅ Allowlist (https://, http://, /, #, mailto:) — правильнее чем blocklist, не упустит будущие vectors
✅ Unescape перед проверкой — учитывает что URL уже HTML-escaped после
escapeHtml(line); иначеjavascript:...или&в URL ломали бы scheme matching✅ Re-escape через
escapeHtml(safeUrl(...))— финальный href корректно экранирован✅ Edge cases все обрабатываются:
JavaScript:→ не матчит allowlist →#javascript%3a...→ нет литерального:для scheme → trailing string, no allowlist match →#"→ escapeHtml re-escapes в"✅
Closes #130иRefs: #127(audit batch)Минор (не блокер, pre-existing)
Link regex
\[([^\]]+)\]\(([^)]+)\)обрезается на первом)в URL. Это стандартное markdown поведение — URL с скобками должны быть %29-кодированы. Не введено этим PR.approve merge