Skip to content

fix(gateway): reject non-object JSON request bodies - #587

Open
Tanjiahao (JiahaoTanXX) wants to merge 1 commit into
microsoft:mainfrom
JiahaoTanXX:fix/gateway-reject-non-object-json
Open

fix(gateway): reject non-object JSON request bodies#587
Tanjiahao (JiahaoTanXX) wants to merge 1 commit into
microsoft:mainfrom
JiahaoTanXX:fix/gateway-reject-non-object-json

Conversation

@JiahaoTanXX

Copy link
Copy Markdown

Summary

  • reject valid JSON payloads whose top-level value is not an object
  • return a clear HTTP 400 response instead of allowing a server-side TypeError
  • cover string, array, number, and null payloads with a parameterized regression test

Validation

  • pytest -q tests/server/test_endpoints.py (26 passed)
  • lightweight CPU test suite (70 passed)
  • ruff check .
  • ruff format --check .
  • python scripts/check_headers.py
  • git diff --check

Copilot AI balanced review requested due to automatic review settings September 7, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The validation prevents the reported server-side failure and is adequately covered.

Pull request overview

Rejects non-object JSON payloads at the gateway before proxy processing.

Changes:

  • Returns HTTP 400 for top-level scalar, array, or null JSON.
  • Adds parameterized regression coverage.
File summaries
File Description
agentlightning/server/routes/proxy.py Validates that parsed request bodies are objects.
tests/server/test_endpoints.py Tests rejection of non-object JSON payloads.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JiahaoTanXX

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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