Skip to content

Allow string app IDs matching [A-Za-z0-9_.] - #4

Merged
jhoyt15 merged 2 commits into
mainfrom
jhoyt_app_id_string
Nov 17, 2026
Merged

jhoyt15 merged 2 commits into
mainfrom
jhoyt_app_id_string

Conversation

@jhoyt15

@jhoyt15 jhoyt15 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

The credentials file previously required the app id to be exactly "100". App ids may now be any non-empty string of letters, digits, '_' or '.'. Hyphens remain disallowed because the OAuth state parameter is {appID}-{redirectURL} and is split on the first hyphen.

The credentials file previously required the app id to be exactly "100".
App ids may now be any non-empty string of letters, digits, '_' or '.'.
Hyphens remain disallowed because the OAuth state parameter is
{appID}-{redirectURL} and is split on the first hyphen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jhoyt15
jhoyt15 requested a review from mw-gregs November 17, 2026 15:10
@jhoyt15 jhoyt15 self-assigned this Nov 17, 2026
Comment thread internal/config.go Outdated
// isValidAppID reports whether id is a non-empty string matching
// [A-Za-z0-9_.]+. Hyphens are excluded because the OAuth state format
// ({appID}-{redirectURL}) is split on the first hyphen.
func isValidAppID(id string) bool {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why not just use a regex validation, like in the comments and error messages? That way it stays consistent.

Comment thread internal/config_test.go Outdated

apps := map[string]AppConfig{
"200": fullTestApp("200"),
"4217": fullTestApp("4217"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

probably should have some of the tests have characters inside and outside of the allowed values. at least some strings like from the examples. or if those are elsewhere, what's the point of this test? we definitely want to prove that we support a pure # like 100 but it seems weird here.

Address review feedback:
- Replace the hand-written character loop with a single compiled
  appIDPattern regex, and reference it in the error message so the
  rule is stated in one place.
- Replace the one-off ID tests with an accepted-IDs test (including
  pure-numeric "100" and the README examples) and a rejected-IDs test
  covering hyphens, whitespace, slashes, punctuation, URL delimiters
  and non-ASCII characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jhoyt15
jhoyt15 requested a review from mw-gregs November 17, 2026 17:59
@jhoyt15
jhoyt15 merged commit d721f36 into main Nov 17, 2026
5 checks passed
@jhoyt15
jhoyt15 deleted the jhoyt_app_id_string branch November 17, 2026 18:19
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.

2 participants