Skip to content

fix(gateway): normalize the domain in the remaining ZT-Domain admin RPCs - #1356

Merged
kvinwang merged 1 commit into
nextfrom
fix/gateway-zt-domain-normalize
Sep 24, 2026
Merged

kvinwang merged 1 commit into
nextfrom
fix/gateway-zt-domain-normalize

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Split from #1235.

normalize_zt_domain is applied by AddZtDomain, GetZtDomain, UpdateZtDomain and DeleteZtDomain, but not by RenewZtDomainCert, ForceReleaseCertLock and ListCertAttestations, which build KV keys from the raw input.

The worst case is ForceReleaseCertLock, the documented escape hatch from a wedged renewal: called with APP.example.com it deleted a key that never existed, returned Ok(()) and logged a release, while renewal stayed wedged. ListCertAttestations silently reported a configured domain as never attested.

Fixed by normalizing in all three. Force-release is moved into a small free helper so it is testable without a Proxy.

force_release_uses_the_key_the_lock_was_taken_under and force_release_refuses_a_malformed_domain fail against next.

ZT-Domain records are keyed by the normalized domain -- trimmed, lowercased,
with the wildcard prefix and root dot stripped -- and Add/Get/Update/Delete all
normalize before touching the store. RenewZtDomainCert, ForceReleaseCertLock
and ListCertAttestations addressed the store with the caller's spelling.

ForceReleaseCertLock is the worst of the three: it is the escape hatch out of a
renewal that wedged, and deleting a key that does not exist is not an error, so
ForceReleaseCertLock("APP.example.com") returned Ok and logged a released lock
while app.example.com stayed locked until the timeout. ListCertAttestations
reported a domain as never attested, and RenewZtDomainCert failed with "config
not found" for a domain that is configured.

Normalize in all three. Force-release moves into a small helper so the path can
be tested without standing up a Proxy, and so the log names the key that was
actually released.
@kvinwang
kvinwang added this pull request to stack #1361 September 24, 2026 08:06
@kvinwang
kvinwang merged commit 8b1a92d into next Sep 24, 2026
14 checks passed
@kvinwang
kvinwang deleted the fix/gateway-zt-domain-normalize branch September 24, 2026 08:07
kvinwang added a commit that referenced this pull request Sep 25, 2026
…k and ListCertAttestations

PR #1356 normalizes the domain in both methods and refuses a name that is
not a DNS name, so the empty request tc-gw-admin-027 and tc-gw-admin-028
sent is now an error. Both send a wildcard, upper-case, trailing-dot
spelling and assert the empty and malformed domains are refused.

Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang added a commit that referenced this pull request Sep 25, 2026
…in spelling

PR #1262 removed certificate issuance from the startup path; the
certificate-bootstrap cases now restart a node against a silent ACME
directory with an uncertified domain configured and require it to listen.
PR #1356 normalizes the domain in ForceReleaseCertLock and
ListCertAttestations; tc-gw-certificat-002 releases a crashed node's lock
with a non-normalized spelling and tc-gw-certificat-007 lists history
under one.

Signed-off-by: Kevin Wang <wy721@qq.com>
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.

1 participant