[PR #42] [MERGED] API: Differentiate bad TXT update error. #265

Closed
opened 2026-03-13 16:14:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/acme-dns/acme-dns/pull/42
Author: @cpu
Created: 2/28/2018
Status: Merged
Merged: 3/13/2018
Merged by: @joohoi

Base: masterHead: cpu-differentiate-errors


📝 Commits (3)

  • efdd560 API: Differentiate bad TXT update error.
  • f463d07 Merge branch 'master' into cpu-differentiate-errors
  • 92f8cc2 Merge branch 'master' into cpu-differentiate-errors

📊 Changes

2 files changed (+72 additions, -5 deletions)

View changed files

📝 api.go (+12 -5)
📝 api_test.go (+60 -0)

📄 Description

Previous to this commit, if the update message had a valid subdomain but
an invalid TXT value the error returned was for a bad subdomain. This can
confuse developers who were POSTing junk TXT records to test acme-dns 😊
Only TXT values that are exactly 43 chars are considered valid: github.com/joohoi/acme-dns@830cceb62c/validation.go (L37-L40)

This commit adjusts the webUpdatePost error handling such that
!validSubdomain(input) and !validTXT(input) give distinct errors.

The !validSubdomain case should never happen in webUpdatePost
because auth.go's Auth function already vets the post data
subdomain but I retained the error handling code just in case.

Unit tests for an update with an invalid subdomain and an update with an
invalid TXT are included.

I did my best to match the repo style for the code/tests but I admit
to hacking this together quickly without having read most of the codebase
yet! Please critique liberally.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/acme-dns/acme-dns/pull/42 **Author:** [@cpu](https://github.com/cpu) **Created:** 2/28/2018 **Status:** ✅ Merged **Merged:** 3/13/2018 **Merged by:** [@joohoi](https://github.com/joohoi) **Base:** `master` ← **Head:** `cpu-differentiate-errors` --- ### 📝 Commits (3) - [`efdd560`](https://github.com/acme-dns/acme-dns/commit/efdd560ee4ebf68801f12484019cb86f35f8abe4) API: Differentiate bad TXT update error. - [`f463d07`](https://github.com/acme-dns/acme-dns/commit/f463d07d0b58a66f22f0c113405dd58e07bdde33) Merge branch 'master' into cpu-differentiate-errors - [`92f8cc2`](https://github.com/acme-dns/acme-dns/commit/92f8cc2802260e6b16fc8df156628d77a2f60f8f) Merge branch 'master' into cpu-differentiate-errors ### 📊 Changes **2 files changed** (+72 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `api.go` (+12 -5) 📝 `api_test.go` (+60 -0) </details> ### 📄 Description Previous to this commit, if the update message had a valid subdomain but an invalid TXT value the error returned was for a bad subdomain. This can confuse developers who were POSTing junk TXT records to test `acme-dns` :blush: Only TXT values that are exactly 43 chars are considered valid: https://github.com/joohoi/acme-dns/blob/830cceb62cb677ba36c686bf11389618fce8aea1/validation.go#L37-L40 This commit adjusts the `webUpdatePost` error handling such that `!validSubdomain(input)` and `!validTXT(input)` give distinct errors. The `!validSubdomain` case should never happen in `webUpdatePost` because `auth.go`'s `Auth` function already vets the post data subdomain but I retained the error handling code just in case. Unit tests for an update with an invalid subdomain and an update with an invalid TXT are included. I did my best to match the repo style for the code/tests but I admit to hacking this together quickly without having read most of the codebase yet! Please critique liberally. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 16:14:24 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/acme-dns#265
No description provided.