Repository navigation
Quote Drive query literals; confine ids to Drive's id alphabet - #10
Merged
Merged
Conversation
File and folder names were spliced into Drive search queries between single quotes, so a key like "x' or title contains '" rewrote the query. Names and ids are now escaped as query literals, and ids parsed from URLs are limited to [A-Za-z0-9_-] (they are also used as local cache paths). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Bare ids use fullmatch (a trailing newline no longer passes). - The uc? URL pattern takes the id= parameter itself, not the last parameter name ending in id=. - Test for upload()'s query; README example no longer suggests splicing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #9
_q()quotes values as Drive query-language literals (backslash and single quote escaped); used for every name/id placed in aqquery.[A-Za-z0-9_-]+(they double as local cache file names).Independent refute-review done; fixed from it: bare ids are fully anchored (trailing newline), the
uc?pattern takes theid=parameter itself (not e.g.x_id=),upload()test, README example. Open question it raised: Drive v2 backslash-escaping is documented for v3; if v2 differs, a title containing a backslash would not match an existing file (duplicate instead of update) — not a security issue.Normal names/ids behave as before. No fleet dependents.
Tests:
tests/test_query_escaping.py(fake Drive capturing the queries); fail on master.🤖 Generated with Claude Code