fix(web): escape memory type badges#137
Merged
Merged
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
tickernelz
approved these changes
Jun 23, 2026
Owner
|
You're the maintainer now, you can merge and release by yourself |
tickernelz
approved these changes
Jun 28, 2026
Owner
There was a problem hiding this comment.
LGTM ✅
Verification:
escapeHtml()helper already exists insrc/web/app.js:1130and the implementation is correct (DOM textContent→innerHTML).- Both sinks (
renderCombinedCardline 186,renderMemoryCardline 284) now escapememory.memoryType. - Test harness uses a
node:vmScript sandbox with a realdocument.createElementmock — not just a string assertion. - Local merge-test clean,
bun test156 pass,typecheck+buildpass.
Scope:
This is correctly scoped — it only closes the XSS sink in memoryType. Memory content, tags, and displayName are already escaped via escapeHtml() / renderMarkdown() (DOMPurify-sanitized).
Nice catch on issue #135.
Owner
|
Merged ✅ Verification on merged
Closes the stored-XSS sink in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the stored XSS vector reported in #135 for
memoryTypebadge rendering.memory.memoryTypewas interpolated directly into Web UI HTML in both standalone memory cards and combined prompt-memory cards. This PR reuses the existingescapeHtml()render-boundary helper so malicious memory type values render as text instead of executable markup.Changes
memory.memoryTypeinrenderMemoryCard()memory.memoryTypeinrenderCombinedCard()<img onerror>payloadVerification
bun test tests/web-memorytype-xss.test.tsbun testbun run typecheckbun run buildScope
This PR intentionally only fixes the
memoryTypestored-XSS sink.Other security concerns from #135, including auth/CORS hardening and broader prompt-injection behavior, should be handled in separate PRs.