fix(recall): scope filter requires directory boundary match - #38
Open
Apageoflove wants to merge 1 commit into
Open
Apageoflove wants to merge 1 commit into
Apageoflove wants to merge 1 commit into
Conversation
_in_scope used raw startswith(scope), so scope=user also matched username/, user-notes/, user2/, and any domain whose name begins with user. Fix: strip trailing slash, then require exact match or a directory separator after the prefix.
Author
|
Just noticed PR #33 covers the same issue with the same directory-boundary approach — it was filed six days before mine and I somehow missed it while working from #17. The only thing mine adds is a regression test for the similar-prefix case. I haven't read #33's branch closely, so not sure yet whether its tests already cover that case too. Happy to close this one or rebase the test onto #33, whatever is less work for you. |
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.
scope=user was matching username/settings.md and user-notes/xxx.md because _in_scope does a raw startswith without checking for a directory boundary. So scope=user leaks results from every domain whose name starts with "user".
Fixed by stripping the trailing slash and requiring either an exact match or a slash after the prefix. Added a regression test covering the collision cases (username, user-notes, user2, users).