fix: fall back to default plan for unknown X-User-Plan values#875
Merged
louise-poole merged 1 commit intomainfrom Mar 11, 2026
Merged
fix: fall back to default plan for unknown X-User-Plan values#875louise-poole merged 1 commit intomainfrom
louise-poole merged 1 commit intomainfrom
Conversation
PlansConfig::resolve() previously returned an error for unknown plan names, causing requests with unrecognized X-User-Plan headers to fail. Now it falls back to the "default" plan if one is configured, or returns None (unrestricted) if no default exists. resolve_plan_restrictions() simplified from Result<Option<_>> to Option<_> since it can no longer fail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
To run Claude review, comment |
Collaborator
Author
|
/review |
Contributor
|
Claude finished @louise-poole's task in 1m 17s —— View job One security concern — see inline comment. |
| defaulting to unrestricted" | ||
| ); | ||
| } | ||
| default |
Contributor
There was a problem hiding this comment.
If plans are configured (e.g. free, pro) but no default key exists, an unrecognised header value returns None here — granting unrestricted access. That only makes sense when no plans are configured at all.
When self.plans is non-empty and no default key exists, an unknown plan name should probably be treated as an error (or at minimum use the most-restrictive available plan) rather than falling back to unrestricted. Fix this →
zizou0x
approved these changes
Mar 11, 2026
|
This PR is included in version 0.147.2 🎉 |
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.
PlansConfig::resolve() previously returned an error for unknown plan names, causing requests with unrecognized X-User-Plan headers to fail.
Now it falls back to the "default" plan if one is configured, or returns None (unrestricted) if no default exists. resolve_plan_restrictions() simplified from Result<Option<>> to Option<> since it can no longer fail.