Skip to content

fix: implement RFC 5155 closest-encloser + next-closer NSEC3 chain validation#148

Merged
poyrazK merged 1 commit intomainfrom
fix/nsec3-nxdomain-validation
May 7, 2026
Merged

fix: implement RFC 5155 closest-encloser + next-closer NSEC3 chain validation#148
poyrazK merged 1 commit intomainfrom
fix/nsec3-nxdomain-validation

Conversation

@poyrazK
Copy link
Copy Markdown
Owner

@poyrazK poyrazK commented May 7, 2026

Summary

  • Rewrite ValidateNSEC3Proof with full RFC 5155 Section 7.2.1 NXDOMAIN proof chain:
    • Find closest-encloser by walking query labels longest→shortest (findClosestEncloserNSEC3)
    • Find next-closer NSEC3 (smallest hash > closest-encloser) and verify hash range covers query
    • Verify no wildcard exists at (closest-encloser + 1 label) (wildcard denial)
    • No-data responses handled via exact-name NSEC3 type bitmap check (early exit)
  • Add new error types: ErrNSEC3NoClosestEncloser, ErrNSEC3NoNextCloser
  • Add helper functions: findClosestEncloserNSEC3, nextCloserNSEC3, wildcardName, nsec3HashLessThan

Fixes: #102

…lidation

ValidateNSEC3Proof now implements the full RFC 5155 Section 7.2.1
NXDOMAIN proof chain instead of just checking hash coverage:

- Find closest-encloser by walking query labels longest→shortest
- Find next-closer NSEC3 (smallest hash > closest-encloser)
- Verify next-closer range covers the query hash
- Verify no wildcard exists at (closest-encloser + 1 label)
- No-data responses checked via exact-name NSEC3 type bitmap

Also adds ErrNSEC3NoClosestEncloser and ErrNSEC3NoNextCloser error
types, and helper functions: findClosestEncloserNSEC3,
nextCloserNSEC3, wildcardName, nsec3HashLessThan.

Fixes: #102
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Warning

Rate limit exceeded

@poyrazK has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 55 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9bbec60-bf87-4aa1-b53d-724a636160bc

📥 Commits

Reviewing files that changed from the base of the PR and between b1b16cc and 3385f0e.

📒 Files selected for processing (1)
  • internal/dns/packet/dnssec_verify.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nsec3-nxdomain-validation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Owner Author

@poyrazK poyrazK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay to merge

@poyrazK poyrazK merged commit 7c9ad38 into main May 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NSEC3 NXDOMAIN validation is incomplete

1 participant