-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: t3chat prompt injection #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 1165834 | Oct 21 2025, 07:01 PM |
How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Code Review: T3 Chat Prompt Injection FixSummaryThis PR addresses a prompt injection vulnerability in the T3 chat integration by refactoring event handlers to conditionally intercept send actions only when supermemories are present. The approach prevents double-submission issues and improves code organization. ✅ Strengths
|
Merge activity
|
Code Review: Fix T3 Chat Prompt InjectionOverall AssessmentThis PR addresses a prompt injection vulnerability by intercepting and controlling the form submission flow when memories are present. The approach is sound, but there are several areas that need attention. 🔴 Critical Issues1. Race Condition with Event Re-dispatch (apps/browser-extension/entrypoints/content/t3.ts:611-620)The current implementation uses setTimeout(() => {
document.removeEventListener("click", handleT3SendButtonClick, true)
sendButton.dispatchEvent(newEvent)
setTimeout(() => {
document.addEventListener("click", handleT3SendButtonClick, true)
}, 100)
}, 100)Issues:
Recommendation: await captureT3PromptContent("button click")
// Remove listener to prevent recursion
document.removeEventListener("click", handleT3SendButtonClick, true)
const form = sendButton.closest("form")
if (form) {
form.requestSubmit()
} else {
sendButton.click()
}
// Re-add listener after next tick
requestAnimationFrame(() => {
document.addEventListener("click", handleT3SendButtonClick, true)
})2. Inconsistent Memory Check Logic (apps/browser-extension/entrypoints/content/t3.ts:587-595, 634-642)The memory presence check is duplicated in both handlers with identical logic: const hasMemories =
textareaElement?.dataset.supermemories ||
(document.querySelector('[id*="sm-t3-input-bar-element"]') as HTMLElement)?.dataset.memoriesDataIssues:
Recommendation: function hasMemoriesPresent(): boolean {
const textareaElement =
(document.querySelector("textarea") as HTMLTextAreaElement) ||
(document.querySelector('div[contenteditable="true"]') as HTMLElement)
const inputBarElement = document.querySelector('[id*="sm-t3-input-bar-element"]') as HTMLElement
return !!(textareaElement?.dataset.supermemories || inputBarElement?.dataset.memoriesData)
}
|
7f2c22b to
1165834
Compare


No description provided.