fix(weave): refuse code-bearing custom objects on server-side decode#7004
Draft
gtarpenning wants to merge 1 commit into
Draft
fix(weave): refuse code-bearing custom objects on server-side decode#7004gtarpenning wants to merge 1 commit into
gtarpenning wants to merge 1 commit into
Conversation
Server-side workers (the evaluate-model worker) reconstruct user-supplied objects. Gate custom-object deserialization on a per-client policy (WeaveClient.allow_unsafe_custom_obj_decode, default True) so workers can refuse to reconstruct Op / load_op-backed custom types at decode time, including dataset rows materialized lazily during evaluation. https://coreweave.atlassian.net/browse/WB-34909 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opcustom type, and anything that falls back to aload_op), which is fine for a normal client but not for a server worker acting on someone else's payload.WeaveClient.allow_unsafe_custom_obj_decode(defaultTrue). The decode path (custom_objs._decode_custom_obj) consults it via the ambient client and refuses to reconstruct code-bearing custom types when it's off. The worker flips it off, so every payload it touches is covered, including dataset rows materialized lazily during evaluation.is_safe_to_decodepredicate is pure and unit-tested. The worker also rejects op refs passed directly as the evaluation/model ref (client.getwould load and run them before decode applies).Testing
unit tests for
is_safe_to_decodeand the object-ref guard, a sync check that everyKNOWN_TYPESentry is consciously classified safe-or-Op, plus an end-to-end evaluate-model test where anOprow in a dataset is refused at decode time.