Repository navigation
fix(tracker): bound peer IDs and addresses on join - #141
Merged
Merged
Conversation
A join's id and address were limited only by the 1 MB request body, and both are repeated in every peer list and in each inventory update about the peer. IDs are now at most 128 characters without whitespace or control characters, and addresses at most 2048 characters. Every bundled client uses short IDs (host names, generated browser IDs, loadtest-NNN, cap-N).
# Conflicts: # CHANGELOG.md # tracker/test/server.test.ts
The previous merge combined two tests appended at the end of the file into one broken block. Rebuild the file from main and append this branch's test.
Owner
Author
|
Self-review:
|
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.
Problem
POST /api/v1/broadcasts/:id/peerschecked only thatidandaddressare non-empty strings, so either could be close to 1 MB (the body limit). Both are repeated in everypeer_list, inpeer_joined, and in each inventory update about the peer: the same amplification class as metadata (#129) and inventories (#138, #139).Change
idmust be at most 128 characters and contain no whitespace or control characters (Unicode\p{Cc}).addressmust be at most 2048 characters. It is still validated as a peer URL afterwards.400with specific messages, and API_REFERENCE documents the limits.Every bundled client fits comfortably: Node peers use the host name, the SDK generates IDs, and the load and capacity tools use
loadtest-NNNandcap-N. Dots, colons, underscores, and hyphens remain allowed.Tests
A new server test accepts a 128-character ID and punctuation, and rejects a 129-character ID, whitespace, NUL, and a 2 KB+ address with the expected messages. tracker: 66 pass.