Repository navigation
dnsext-iterative: DS の問い合わせを親へ送る - #293
Merged
Merged
Conversation
kazu-yamamoto
force-pushed
the
fix-parent-ds
branch
from
October 9, 2026 09:27
8f175e8 to
8b3cc96
Compare
kazu-yamamoto
force-pushed
the
fix-parent-ds
branch
from
October 24, 2026 04:09
8b3cc96 to
ba9bfbe
Compare
kazu-yamamoto
force-pushed
the
fix-parent-ds
branch
from
November 18, 2026 02:17
ba9bfbe to
2614e80
Compare
A DS belongs to the parent: RFC 4034 Sec 5 has it appear only on the
parental side of a delegation and RFC 4035 Sec 2.4 has it not appear at
the zone's apex, so the zone itself is the one server certain not to
have it.
The scenario's root delegates example. and vouches for it with a DS, and
example. delegates two children and vouches for neither -- one which
answers and one whose server is not there. Three of the four examples
fail:
- example. DS gives an empty answer, though the root has a DS for it
and bowline verified that DS on the way down;
- having been asked, bowline then serves the rest of example.
unvalidated, the empty answer having been cached as "no DS";
- lame.example. DS is SERVFAIL, because the child's servers are asked
a question only its parent can answer.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
外部テストの代わりに doctest で確認を行なう。次のコミットで resolveExact の doctest に置き換える。 応答の AD ビット、キャッシュ後の検証、応答しない委任先の経路は、その doctest では見ない。 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
example. をスタブゾーンに置き、queryNorec を差し替えて a.example. への委任を返させる。 resolveExact が返す委任のゾーンで、DS だけが親の example. に送られることを見る。 この時点では "a.example." で赤になり、次の修正コミットで緑になる。 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
resolveExactDC walks down to the deepest delegation for the name asked about and sends the question there. For a DS that is the delegation to the name itself, so the question goes to the zone -- the one server which RFC 4034 Sec 5 and RFC 4035 Sec 2.4 between them guarantee has no DS at that name, a DS living on the parental side and not at an apex. So a DS query was answered NODATA by the zone whose DS was being asked for, however good the DS in its parent was. bowline fetched and verified that DS on the way down, threw it away, asked the child, and handed back the child's empty answer with AD set. That answer is then cached as "no DS", and the whole subtree is served unvalidated from then on: one ordinary question turns a secure zone insecure for every client of the cache. Where the delegation is insecure the parent proves there is no DS and bowline verifies the proof -- and then asked the child anyway, so a delegation whose servers had stopped answering failed the query outright, with CD set as well as without. Lame servers under an insecure delegation are not rare. For a DS the walk now stops at the delegation above the name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Kei Hibino <ex8k.hibino@gmail.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
khibino
force-pushed
the
fix-parent-ds
branch
from
November 20, 2026 09:03
2614e80 to
819c6ef
Compare
Collaborator
|
外部テストをやめて、doctest 化しています。 CI が通ったらマージするつもりです。 |
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.
#292 を直します。問題と再現条件は #292 に書いてあります。
どこがどう間違っていたか
dnsext-iterative/DNS/Iterative/Query/ResolveJust.hsのresolveExactDC。iterativeが降りていく先はnに対する最深の委任、つまりnへの委任です。そのサーバ群は子ゾーンのものなので、DS を尋ねる相手として唯一間違っています。DS 以外のすべての型ではこれで正しい動きです。どう直したか
DS のときだけ、歩く名前の列から末尾を落とします。
stopAbove ds | typ == DS = dropLast ds | otherwise = ds dropLast [] = [] dropLast ds = init dssuperDomains'は浅い順でnで終わる列を返すので、末尾を落とせば 1 つ上の委任まで歩きます。example.com. DSならcom.のサーバへ、sub.example.com. DSならexample.com.のサーバへ。iterativeに[]を渡すとアンカーが返るので、アンカーゾーン直下の名前も正しく扱えます。どの層・どのパッケージ
dnsext-iterativeのResolveJust。resolveExactDCには他に 3 つの呼び出し元がありますが、どれも DS を渡しません(Resolve.hs:240は CNAME、ResolveJust.hs:672は NS アドレスの解決、Resolve.hs:252は問い合わせ側の型で、これが修正対象の経路)。どう確かめたか
シナリオを先に落としてから直しています(
888ca312→8b3cc960)。dnsext-scenario/test/parent-ds/は、ルートがexample.を DS 付きで委任し、example.が保証しない子を 2 つ委任します。up.example.は答えるサーバを持ち、lame.example.は居ないサーバを指します。修正前は 4 例中 3 例が赤です。cabal build all --enable-tests、dnsext-scenario74 例、dnsext-iterative51 例(実インターネット)、fourmolu すべて緑。#294・#295・#302 と重ねた状態でもdnsext-scenario77 例・dnsext-dnssec61 例・dnsext-iterative51 例が緑でした(衝突はdnsext-dnssec.cabalのother-modules1 行だけ)。🤖 Generated with Claude Code