Skip to content

fix(pat): stop over-specifying PAT shape in error and docs (DEVEX-889)#131

Merged
jpage-godaddy merged 3 commits into
rust-portfrom
pat-validation
Jul 20, 2026
Merged

fix(pat): stop over-specifying PAT shape in error and docs (DEVEX-889)#131
jpage-godaddy merged 3 commits into
rust-portfrom
pat-validation

Conversation

@jpage-godaddy

@jpage-godaddy jpage-godaddy commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • pat add rejected valid tokens with an error that hinted at a gd_pat_<entropy>_<crc> shape which we don't really need users to care about; is_valid_pat now only checks for the gd_pat_ prefix plus non-empty, whitespace-free content after it, and the rejection error points to gddy guide auth instead of restating format rules.
    • Refined during review: the prefix check alone would have accepted an untrimmed value like 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.
  • Synced rust/src/pat/guides/auth.md with the real Developer Portal flow (PAT creation/revocation steps, direct links to the Personal Access Token page).

Test plan

  • cargo test pat:: — 16/16 pass
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt -- --check — clean
  • Manual: pat add with 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

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_pat to validate only the gd_pat_ prefix (instead of enforcing an entropy/CRC structure) and updated the pat add rejection message to point users to gddy guide auth.
  • Updated PAT-related tests to reflect the new, less-prescriptive validation behavior.
  • Refreshed rust/src/pat/guides/auth.md to 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.

Comment thread rust/src/pat/mod.rs Outdated
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread rust/src/pat/mod.rs
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread rust/src/pat/mod.rs
@jpage-godaddy
jpage-godaddy merged commit 92144a3 into rust-port Jul 20, 2026
2 checks passed
@jpage-godaddy
jpage-godaddy deleted the pat-validation branch July 20, 2026 23:42
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.

3 participants