Skip to content

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

Merged
ElfredSeow merged 2 commits into
mainfrom
security-fixes-consolidated
Jul 24, 2026
Merged

Potential fix for code scanning alert no. 244: Type confusion through parameter tampering#4
ElfredSeow merged 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>
@ElfredSeow
ElfredSeow marked this pull request as ready for review July 24, 2026 07:40
Copilot AI review requested due to automatic review settings July 24, 2026 07:40
@ElfredSeow
ElfredSeow merged commit 666ca9a into main Jul 24, 2026
18 of 28 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants