fix(wire): cap ParseRequest fields to max valid per command+type (PILOT-307)#6
fix(wire): cap ParseRequest fields to max valid per command+type (PILOT-307)#6matthew-pilot wants to merge 1 commit into
Conversation
…OT-307) ParseRequest uses strings.Fields which splits into an unbounded slice from any-length input. While the transport layer caps message size, this adds in-process protection by rejecting requests whose field count exceeds the maximum valid for the given command+record-type. Added maxRequestFieldsFor() that returns the expected maximum for each valid (command, type) pair, checked before the main switch block. Existing tests updated — TestParseRequestExtraFields now expects rejection of over-field requests instead of silent acceptance. Closes PILOT-307
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🔍 PR Explanation — #6 PILOT-307What this doesAdds field-count validation to The problem
The fix1. New function
2. Pre-switch gate (
3. Test update (
Design choices
|
📊 PR Status — #6 PILOT-307
CI Checks (2/2 passing)
CanaryNot yet triggered — Linked JiraPILOT-307 — nameserver: strings.Fields is unbounded on input line Last operator activityNo operator (TeoSlayer) activity detected on this PR. |
What
ParseRequest uses strings.Fields which splits into an unbounded slice from any-length input. While the transport layer caps message size, this adds in-process protection by rejecting requests whose field count exceeds the maximum valid for the given command+record-type.
Why
Closes PILOT-307 (nameserver: strings.Fields is unbounded on input line).
How
Added maxRequestFieldsFor() that returns the expected maximum for each valid (command, type) pair, checked before the main switch block. Updated TestParseRequestExtraFields to expect rejection of over-field requests instead of silent acceptance.
Verification
go build ./...✓go vet ./...✓go test ./... -count=1✓Closes https://vulturelabs.atlassian.net/browse/PILOT-307