fix(cache): isolate client_ip-scoped static responses from dns_cache - #39
Merged
Conversation
Static decisions from pipelines that match on client_ip no longer write to dns_cache, whose key has no client dimension and could leak answers across clients. rule_cache already caches static decisions with client-IP isolation, so caching remains correct. Also adds a response-action path test for static_ip_response qtype filtering, and documents the UDP response size limit for large address lists.
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
client_ipmatcher no longer write todns_cache, whose key has no client dimension and could leak cached answers across clientsrule_cachealready caches static decisions with client-IP isolation, so caching remains correctstatic_ip_responseqtype filtering (A/AAAA/HTTPS)Background
Follow-up to review findings on PR #36:
dns_cache'sdedupe_hashdoes not includeclient_ip. When a pipeline rule uses aclient_ipmatcher and produces a static decision, the first client's static answer could be served to a different client via the DNS cache.handle_static_decisionnow skipsdns_cacheinsertion when the pipeline uses aclient_ipmatcher. Rule-cache isolation (key + entry + match) already covers this case, so there is no caching regression.Behavior
client_ipmatcher +static_ip_response: answer is built per query, cached inrule_cache(client-isolated), and never entered intodns_cacheclient_ipmatcher: unchanged (dns_cachecaching as before)apply_response_actions) covered by a new test for qtype filteringValidation
cargo fmt --all -- --checkcargo test(120 unit tests, 6 listener tests, 9 DoH integration tests, 10 doctests)cargo clippy --all-targets --all-features -- -D warningsgit diff --check