Skip to content

fix: only allow alphanumeric OIDC client names to keep environment variables valid - #1131

Open
LukasSkywalker wants to merge 1 commit into
tinyauthapp:mainfrom
LukasSkywalker:fix/oidc-client-config-validation
Open

fix: only allow alphanumeric OIDC client names to keep environment variables valid#1131
LukasSkywalker wants to merge 1 commit into
tinyauthapp:mainfrom
LukasSkywalker:fix/oidc-client-config-validation

Conversation

@LukasSkywalker

@LukasSkywalker LukasSkywalker commented Sep 13, 2026

Copy link
Copy Markdown

See #1130

Summary by CodeRabbit

  • Bug Fixes
    • OIDC client creation now validates names consistently.
    • Client names must contain only letters and numbers; hyphens and other special characters are rejected with a clear error message.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 3ffed853-840c-4380-8369-cb123291d60b

📥 Commits

Reviewing files that changed from the base of the PR and between 653b747 and 49e28de.

📒 Files selected for processing (1)
  • cmd/tinyauth/create_oidc_client.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The OIDC client creation command now accepts only non-empty alphanumeric client names. It uses regexp.MustCompile for validation and declares the YAML rendering error at its use site.

Changes

OIDC client name validation

Layer / File(s) Summary
Enforce alphanumeric client names
cmd/tinyauth/create_oidc_client.go
The client name pattern now requires one or more alphanumeric characters and rejects hyphens. The validation error text reflects this rule. The YAML rendering error is declared with :=.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: steveiliop56

Merge Risk: ⚪ Minimal · up to 49e28

The PR enforces the intended alphanumeric client-name constraint without an identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: restricting OIDC client names to alphanumeric characters to keep generated environment variables valid.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

// Only alphanumeric since the name will be turned into environment variable names
if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(clientName) {
return errors.New("client name can only contain alphanumeric characters")
}

@LukasSkywalker LukasSkywalker Sep 13, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Change the regex match method as well: MatchString(pattern string, s string) only returns an error if the pattern parsing failed. With MustCompile() and MatchString(s string), this check is moved to compile time.

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