Skip to content

bug: fix prototype pollution in chat message handler - #235

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787665393-chat-prototype-pollution
Open

bug: fix prototype pollution in chat message handler#235
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787665393-chat-prototype-pollution

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 25, 2026

Copy link
Copy Markdown

Summary

PUT /chat merged the attacker-controlled req.body.message straight into a fresh object with _.merge, so {"message": {"__proto__": {"canDelete": true}}} polluted Object.prototype and granted every user delete rights (see exploits/prototype-pollution.sh c3/c4).

chat.add now builds the message from an explicit field allowlist instead of merging:

for (const field of ['icon', 'text']) {
  if (input && Object.prototype.hasOwnProperty.call(input, field)) { /* must be a string */ }
}

__proto__/constructor are never own-enumerable keys that get copied, and non-object or non-string input is rejected with 400. chat.delete additionally requires canDelete to be an own property equal to true, so any other pollution vector cannot grant the capability.

Devin-Org: engineering


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Devin Review (Staging)

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.

0 participants