Skip to content

fix(notes): sanitize rendered Markdown HTML (XSS) - #171

Merged
snehmatic merged 2 commits into
snehmatic:mainfrom
iuyua9:codex/mindloop-notes-xss-20260813
Sep 3, 2026
Merged

fix(notes): sanitize rendered Markdown HTML (XSS)#171
snehmatic merged 2 commits into
snehmatic:mainfrom
iuyua9:codex/mindloop-notes-xss-20260813

Conversation

@iuyua9

@iuyua9 iuyua9 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • sanitize rendered Markdown at the shared mdToHTML boundary before it is marked as trusted template HTML
  • cover both note and journal views without changing stored content
  • add malicious-input and common-Markdown regression tests

Security impact

User-authored Markdown was passed through template.HTML without an HTML policy, allowing stored script, event-handler, iframe, and javascript-URL payloads. bluemonday.UGCPolicy removes those unsafe constructs while retaining standard Markdown formatting.

Validation

  • go test ./api/v1 -run TestMdToHTML -count=1
  • go test ./... -run '^$'
  • go vet ./...
  • git diff --check

Closes #25

@snehmatic
snehmatic merged commit 60690f9 into snehmatic:main Sep 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Notes feature

3 participants