asterix: replace private pickle transport with JSON - #1728
Merged
Conversation
Contributor
|
Merged, thanks! |
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.
Fixes #1725.
Summary
Replace the private
genobstacles-> Asterix Python pickle transport with standard-library JSON.The Asterix UDP listener previously passed
PICKLED:payloads received over UDP topickle.loads(). A crafted pickle could therefore execute Python reducers during deserialization.The built-in
genobstaclesmodule also used this private format, so the producer and consumer are migrated together.Important note
There must have been some reason that pickle was used here instead of json, which I cannot retrace.
This is why I opened two seperate PRs.
This changes the undocumented private wire format between
genobstaclesandAsterix, so mixed old/new module versions are not compatible. Both in-tree
producer and consumer are updated together.
JSON also increases representative obstacle packets by approximately 220–250
bytes compared with pickle. The largest tested packet is about 1.2 KB, well
below the existing 10,240-byte receive limit. See below.
Changes
genobstaclesnow emitsJSON:packets usingjson.dumps().json.loads().PICKLED:packets are explicitly rejected without deserialization.asterix.parse().The currently generated obstacle packets contain only dictionaries, strings, integers, and floats.
Aircraft,BirdOfPrey,BirdMigrating, andWeatherpackets were all verified to round-trip exactly through JSON.Legacy external
PICKLED:senders are intentionally incompatible with this change. No documentation or public interface for that private wire format was found, and retainingpickle.loads()would retain the vulnerability.Security regression test
The original exploit packet shape was replayed against the patched production Asterix UDP receive path.
The test verifies that:
genobstaclesJSON serializer is accepted over real UDP;PICKLED:packets are rejected without parsing;asterix.parse().Standalone regression test
The test produced:
No
pickle.loads()orpickle.dumps()remains in the two production modules.JSON compatibility
Representative generated obstacle packets were also checked before making the change:
The largest observed JSON packet was about 1.2 KB, well below the existing 10,240-byte UDP receive size.
Repository checks
All passed.