Skip to content

[Backend] sandboxMiddleware trusts client-supplied X-Sandbox-Mode header even when sandbox mode is globally disabled path is untested #1016

Description

@grantfox-oss

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

sandboxMiddleware only skips sandbox detection when config.enabled is false, but there is no test asserting that a malicious client cannot flip req.sandbox to true by sending X-Sandbox-Mode when SANDBOX_MODE_ENABLED is unset.

Acceptance criteria

  • Add a unit test that calls sandboxMiddleware with config.enabled=false and an X-Sandbox-Mode header set
  • Assert req.sandbox and req.sandboxMode remain false

Files to touch

  • backend/src/middleware/sandbox.middleware.ts
  • backend/src/config/sandbox.ts

Out of scope

Does not change the middleware's behavior, test-only unless a gap is found.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related tasksenhancementNew feature or requestsecuritySecurity related tasks

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions