Skip to content

Fix: prevent client-controlled field injection in message and job creation#9035

Open
clarboncy wants to merge 2 commits into
SecureBananaLabs:mainfrom
clarboncy:fix/field-injection
Open

Fix: prevent client-controlled field injection in message and job creation#9035
clarboncy wants to merge 2 commits into
SecureBananaLabs:mainfrom
clarboncy:fix/field-injection

Conversation

@clarboncy

Copy link
Copy Markdown

Summary

Fixes field injection vulnerability in sendMessage() and createJob() where object spread after server-controlled fields allowed clients to override id, status, and sentAt.

Changes

  • apps/api/src/services/messageService.js: Moved ...payload before id and sentAt so server values take precedence
  • apps/api/src/services/jobService.js: Moved ...payload before id and status so server values take precedence

Before (vulnerable)

const message = { id: `msg_${Date.now()}`, ...payload, sentAt: new Date().toISOString() };
// Client can send id and sentAt in payload to override server values

After (fixed)

const message = { ...payload, id: `msg_${Date.now()}`, sentAt: new Date().toISOString() };
// Server values always take precedence over client input

Closes #9034

github-actions Bot added a commit that referenced this pull request Jun 27, 2026
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.

Message and job creation allow client-controlled field injection via object spread

1 participant