Skip to content

Potential fix for code scanning alert no. 244: Type confusion through parameter tampering#4

Draft
ElfredSeow wants to merge 2 commits into
mainfrom
security-fixes-consolidated
Draft

Potential fix for code scanning alert no. 244: Type confusion through parameter tampering#4
ElfredSeow wants to merge 2 commits into
mainfrom
security-fixes-consolidated

Conversation

@ElfredSeow

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/raid-ppcoe/open-design/security/code-scanning/244

General fix: validate runtime type of untrusted HTTP body before using it in downstream logic, and reject unsupported/body-shape variants instead of coercing everything.

Best fix here (without changing intended functionality for normal API clients):
In apps/daemon/src/routes/vela.ts, tighten velaProxyRequestBody to only accept Buffer, string, plain JSON objects, and null/undefined; explicitly reject arrays and other non-plain objects by returning an invalid marker. Then in proxyAmrApiRequest, handle invalid bodies with 400 and stop processing. This prevents type confusion from parameter tampering while preserving existing behavior for valid request bodies.

Needed changes:

  • Add a small helper to check for plain objects.
  • Change velaProxyRequestBody return type to include undefined as “invalid”.
  • Add a guard in proxyAmrApiRequest after body extraction.
  • No new imports required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

ElfredSeow and others added 2 commits June 24, 2026 00:11
… parameter tampering

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
… parameter tampering

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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.

1 participant