fix: tenant id validation - #1740
Merged
Merged
Conversation
Contributor
WalkthroughThe change adds public tenant ID validation with a lazy regex. Tenant creation and tenant directory loading validate IDs before updating state or processing metadata. ChangesTenant ID validation
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/parseable/mod.rs`:
- Around line 1281-1282: Move the validate_tenant_id call in the
directory-processing flow into the is_multi_tenant conditional, keeping it
before tenant metadata loading. Ensure single-tenant mode accepts root or stream
directory names without tenant-pattern validation, while multi-tenant mode still
validates tenant IDs.
- Around line 107-121: Update TENANT_ID_REGEX and validate_tenant_id so tenant
IDs contain only alphanumeric characters while preserving the 1–36 character
limit. Check DEFAULT_TENANT before applying the regex so its dedicated error
remains reachable, and update the validation error text to match the new
alphanumeric-only pattern.
- Around line 113-121: Update Parseable::add_tenant to call validate_tenant_id
on tenant_id before storing it in either registry, propagating the validation
error and preventing invalid IDs or DEFAULT_TENANT from being registered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Restrict DEFAULT_TENANT, and non-alphanumeric characters as tenant id
parmesant
force-pushed
the
tenant-id-validation
branch
from
August 4, 2026 06:05
36cc8da to
b63971e
Compare
nikhilsinhaparseable
approved these changes
Aug 4, 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.
Restrict
DEFAULT_TENANT, and other values which can be trigger path manipulation as tenant idFixes #XXXX.
Description
This PR has:
Summary by CodeRabbit