Skip to content

fix(endpoint): validate CNAME, NS, DNAME, alias and TLSA targets - #6896

Open
Davien21 wants to merge 1 commit into
kubernetes-sigs:masterfrom
Davien21:checkendpoint-target-validation
Open

Davien21 wants to merge 1 commit into
kubernetes-sigs:masterfrom
Davien21:checkendpoint-target-validation

Conversation

@Davien21

@Davien21 Davien21 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What does it do ?

Endpoint.Validate now checks targets for CNAME, NS and DNAME records and for alias A/AAAA/CNAME records (they must be domain names), and for TLSA (parsed with NewTLSARecord).

The domain-name check rejects whitespace and empty labels before calling dns.IsDomainName, which on its own accepts bad target because a wire-format label can hold any octet. Underscore labels stay valid.

Motivation

Fixes #6874. Some providers apply an update as a non-atomic delete plus create. With an invalid target the delete goes through, the create fails, and nothing is reported: rfc2136 sends only the removal for CNAME "bad target", and Cloudflare does the same for TLSA. Rejecting these endpoints in Validate drops them in the dedup wrapper (with a warning and the invalid_endpoints metric) before any provider sees them.

Tested with go test ./... (-race on ./endpoint/... and ./source/wrappers/...) and golangci-lint run ./endpoint/... (v2.14.0, 0 issues). TestServiceSource/Endpoints needs live DNS and failed in my sandbox with or without this change. The 9 new invalid-target cases in TestValidate fail on master.

This PR was written in part with the assistance of generative AI.

@adityamukesh I had this ready from the #6873 validation work. If you're already deep into it, I'm happy to close this.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ivankatliarchuk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the docs label Oct 29, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from szuecs and vflaux October 29, 2026 09:22
@kubernetes-prow kubernetes-prow Bot added source cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 29, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @Davien21. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 29, 2026
@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2026
@Davien21
Davien21 force-pushed the checkendpoint-target-validation branch from 9b2bb09 to 5f214db Compare November 4, 2026 13:08
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2026
@Davien21 Davien21 changed the title fix(endpoint): validate CNAME, NS, DNAME, alias, TLSA and NAPTR targets fix(endpoint): validate CNAME, NS, DNAME, alias, TLSA and NAPTR targetsfix(endpoint): validate CNAME, NS, DNAME, alias and TLSA targets Nov 6, 2026
@Davien21 Davien21 changed the title fix(endpoint): validate CNAME, NS, DNAME, alias, TLSA and NAPTR targetsfix(endpoint): validate CNAME, NS, DNAME, alias and TLSA targets fix(endpoint): validate CNAME, NS, DNAME, alias and TLSA targets Nov 6, 2026
@Davien21
Davien21 force-pushed the checkendpoint-target-validation branch from 5f214db to 13fffa5 Compare November 24, 2026 12:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. docs needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CheckEndpoint: validate TLSA, CNAME, NS, DNAME, NAPTR and alias targets

1 participant