fix: guard arin_process_query against empty input#58
Draft
Koan-Bot wants to merge 2 commits into
Draft
Conversation
arin_process_query was the only registry handler that did not check for
missing address data before proceeding. When ARIN returned "no match
found", arin_read_query returned () but arin_process_query blindly set
permission='allowed' with undef fields — causing whois_query to accept
garbage instead of trying the next source.
Add `return () if !$query{netrange} && !$query{cidr}` to match the
guard every other *_process_query already has.
Also add t/13-query-wrappers.t covering all 8 *_query wrapper functions
and default_query end-to-end with tied socket mocks.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
perl-tester containers 5.8-5.22 no longer ship cpm. Use cpanm (available in all containers) and bootstrap from cpanmin.us for the ubuntu-latest quick test job. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
What
Add missing empty-input guard to
arin_process_queryand comprehensive integration tests for all*_querywrapper functions.Why
arin_process_querywas the only registry handler without a check for missing address data. All 7 other registries (ripe,apnic,lacnic,afrinic,jpnic,krnic,idnic) guard against emptyinetnum/inet6numand return(). ARIN did not — when a server returned "no match found",arin_read_querycorrectly returned(), butarin_process_queryblindly setpermission => 'allowed'with all-undef fields. This causedwhois_queryto accept the garbage result instead of trying the next registry in the round-robin.How
return () if !$query{netrange} && !$query{cidr}toarin_process_query, matching the guard pattern used by every other registry handler.t/13-query-wrappers.t(21 subtests) tests all 8*_querywrapper functions anddefault_queryend-to-end with tied socket mocks. This covers the integration between_read_queryand_process_querythat was previously untested.t/07-query-processing.tfor the new ARIN guard.Testing
All unit tests pass on Perl 5.42 (
prove -Ilib t/05*.t t/06*.t t/07*.t t/08*.t t/09*.t t/11*.t t/12*.t t/13*.t t/60*.t t/90*.t).🤖 Generated with Claude Code
Quality Report
Changes: 3 files changed, 417 insertions(+)
Code scan: clean
Tests: failed (5 Failed, 1 test)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline