mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2615] [Issue]: Discord webhook mirror omits allowed_mentions — LLM/user content can @everyone/@here-ping the server #1288
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1288
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @Romuromylus on GitHub (Jun 18, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2615
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Medium — security. The Discord webhook mirror posts message content with no
allowed_mentionsfield. Discord's default when that field is omitted is to parse all mentions, so@everyone/@here/role/user pings in mirrored LLM output, imported-card-injected output, or user messages reach Discord and ping the whole channel/server.Expected behavior
Mirrored content should never trigger Discord mentions. The webhook payload should suppress
@everyone/@here/role/user pings on relayed text.Actual behavior
postToDiscordWebhookbuilds a payload with onlycontent/username/avatar_url— noallowed_mentions:The relayed
contentis raw and unsanitized on all call paths:generate.routes.ts:6070(content: fullResponse, raw LLM output),generate.routes.ts:1208(content: pendingUserDiscordMsg, raw user input frominput.userMessage), andgame.routes.ts:971(mirrorGameMessageToDiscord). Agrepoverpackages/serverforallowed_mentions/@everyone/@herereturns no matches — there is no mention stripping anywhere. A malicious imported card/lorebook/persona can prompt-inject the model to emit@everyone/<@&ROLE_ID>, the model can emit them spontaneously, or a user message carrying them is mirrored verbatim — the bot then mass-pings on every mirrored turn.Steps to reproduce
@everyoneor<@&ROLE_ID>.Environment
staging @ 56f700cd(v2.0.0)Logs, screenshots, or video
Static source audit, cited to file:line above.
Additional context
Fix sketch. Extend
WebhookPayloadwithallowed_mentions?: { parse: string[]; roles?: string[]; users?: string[] }and setallowed_mentions: { parse: [] }on every body built inpostToDiscordWebhook, so Discord suppresses@everyone/@here/role/user pings while leaving the relayed text intact. This neutralizes mention-injection from LLM output and imported content at the single choke point.Regression notes. Not a regression —
discord-webhook.tsis byte-identical onmain(same interface, same body, noallowed_mentions). Shared engine code on both branches. (The prior matching finding #2369 was on the discontinued refactor line, not this staging/web line.)Template check
@Romuromylus commented on GitHub (Jun 18, 2026):
Fixed in #2623, merged to
staging(e1132e5b). Closing manually since the PR targetedstagingrather than the default branch.