Skip to content

Harden order-model HTTP transport against unsafe deserialization - #30

Merged
Yang Liu (DG-git-dev) merged 3 commits into
mainfrom
fix/order-model-safe-wire-format
Sep 23, 2026
Merged

Yang Liu (DG-git-dev) merged 3 commits into
mainfrom
fix/order-model-safe-wire-format

Conversation

@DG-git-dev

Copy link
Copy Markdown
Contributor

Summary

The order-model HTTP endpoint previously deserialized request bodies with pickle.loads, and the client deserialized its responses the same way. Replace both directions with a fixed-size little-endian int32 format so network data cannot invoke Python object deserialization. The server now rejects malformed, oversized, and wrong-media-type requests, and the default HTTP bind address is localhost.

The client and server must be upgraded together because the wire format changes.

Validation

  • python -m unittest tests.test_wire_format -v (4 passed)
  • git diff --check
  • Live Ray Serve HTTP route with fixed test inference: valid request 200; short request 400; oversized request 413; legacy pickle request 400
  • PyTorch tensor inference path with a test model produced the expected binary int32 response
  • Existing validation sample is int32 with shape (1024, 15) and round-trips through the new format

Full pretrained-model GPU inference was not run in this local environment.

@DG-git-dev

Copy link
Copy Markdown
Contributor Author

Yang Liu (Yang Liu (@DG-git-dev)) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="Microsoft"

Co-authored-by: DG-git-dev <78746494+DG-git-dev@users.noreply.github.com>
@DG-git-dev
Yang Liu (DG-git-dev) merged commit ecb738e into main Sep 23, 2026
8 checks passed
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