fix: normalize trailing slashes before length check in check_resource_allowed#2074
Merged
felixweinberger merged 1 commit intomainfrom Feb 17, 2026
Merged
Conversation
…_allowed The length check rejected equivalent paths like /api vs /api/ because the trailing slash made the configured path longer. Move trailing slash normalization before the comparison so paths differing only by a trailing slash are treated as equivalent. Also removes redundant normalization from _validate_resource_match since check_resource_allowed now handles it correctly.
9 tasks
pcarleton
approved these changes
Feb 17, 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.
Motivation and Context
check_resource_allowedincorrectly rejected equivalent paths like/apivs/api/because the length check ran before trailing slash normalization. For example,check_resource_allowed("https://example.com/api", "https://example.com/api/")returnedFalseeven though these should be equivalent.This also caused redundant normalization in
_validate_resource_matchwhich worked around the bug.Found during review of #2069 (v1.x backport).
How Has This Been Tested?
FalsetoTruefor the/apivs/api/caseBreaking Changes
None — this is a bug fix that makes the function more permissive.
Types of changes
Checklist