fix(pat): stop over-specifying PAT shape in error and docs (DEVEX-889)#131
Merged
Conversation
pat add rejected tokens with an error that hinted at a specific gd_pat_<entropy>_<crc> shape GoDaddy doesn't actually guarantee, and the auth guide repeated that assumption. Loosen is_valid_pat to a plain gd_pat_ prefix check, point the rejection error at `gddy guide auth` instead of restating format rules, and sync the guide's PAT lifecycle steps (creation, revocation) with the real Developer Portal flow.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR relaxes Personal Access Token (PAT) validation in the gddy pat module to avoid assuming a stable GoDaddy PAT structure beyond the gd_pat_ prefix, and updates the bundled auth guide to match the current Developer Portal PAT workflow.
Changes:
- Simplified
is_valid_patto validate only thegd_pat_prefix (instead of enforcing an entropy/CRC structure) and updated thepat addrejection message to point users togddy guide auth. - Updated PAT-related tests to reflect the new, less-prescriptive validation behavior.
- Refreshed
rust/src/pat/guides/auth.mdto align with the real PAT creation/revocation steps and links in the Developer Portal.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rust/src/pat/mod.rs | Loosens PAT validation and adjusts the user-facing error message + tests accordingly. |
| rust/src/pat/guides/auth.md | Updates the PAT auth guide steps/links to mirror the Developer Portal flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
An untrimmed env var (e.g. a trailing newline) would otherwise pass is_valid_pat and be sent as a garbage Bearer token, producing a confusing auth failure instead of a clear rejection.
Rejecting only whitespace-only tails still let values like gd_pat_abc123\n (e.g. read from a file with a trailing newline) through, which would be sent as a garbage Bearer token instead of failing with a clear error.
qcai-godaddy
approved these changes
Jul 20, 2026
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.
Summary
pat addrejected valid tokens with an error that hinted at agd_pat_<entropy>_<crc>shape which we don't really need users to care about;is_valid_patnow only checks for thegd_pat_prefix plus non-empty, whitespace-free content after it, and the rejection error points togddy guide authinstead of restating format rules.gd_pat_abc123\n(e.g. from an env var or file with a trailing newline), which would then be sent as a garbage Bearer token instead of failing with a clear error. Any embedded whitespace after the prefix is now rejected too.rust/src/pat/guides/auth.mdwith the real Developer Portal flow (PAT creation/revocation steps, direct links to the Personal Access Token page).Test plan
cargo test pat::— 16/16 passcargo clippy --all-targets -- -D warnings— cleancargo fmt -- --check— cleanpat addwith the exact sample tokens from DEVEX-889's bug report now succeed; a non-PAT string, and an untrimmed/whitespace-containing token, are still rejected with the new error message🤖 Generated with Claude Code