-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(tools): reject path traversal in Drive, BigQuery, Box, Supabase and Contacts ids #7269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
d36e6c8
fix(github): reject path-traversal values in interpolated URL segments
waleedlatif1 64273cf
fix(github): stop safeUrlPath trimming real filename whitespace
waleedlatif1 515b951
fix(github): permit a whitespace-only path component
waleedlatif1 d2c74d7
fix(github): refuse a padded identifier on state-changing requests
waleedlatif1 0c5108e
docs(github): record why the strict guards stop at writes
waleedlatif1 ccbf0d2
fix(github): reject a backslash in safeEncodedUrlPathSegment
waleedlatif1 2ce0e27
fix(tools): reject path traversal in Drive, BigQuery, Box, Supabase a…
waleedlatif1 8f59a57
test(tools): stop the coverage pin from being blind to non-function URLs
waleedlatif1 d6b4e6f
test(tools): catch balanced traversal and pin the full single-segment…
waleedlatif1 850f069
fix(bigquery): send one project id in both the URL and the request body
waleedlatif1 6d76111
test(bigquery): drop dotted ids from the per-parameter allowlist
waleedlatif1 158e3dd
docs(box_sign): describe the defect in past tense, not the fixed code
waleedlatif1 7ba83ee
fix(bigquery): derive body identifiers from the path guard, not a bar…
waleedlatif1 b11e847
test(tools): probe sibling branch literals in pairs, not just singly
waleedlatif1 56ac387
fix(bigquery): refuse a padded projectId instead of silently resolvin…
waleedlatif1 660bd58
fix(supabase): report storage path-guard failures as 400, not 500
waleedlatif1 e69be67
fix(box_sign): refuse a padded signRequestId instead of silently reso…
waleedlatif1 df3082e
test(tools): stop the preserves-whitespace branch swallowing a rejection
waleedlatif1 fa93d21
test(tools): fail when a guard rejects a value it must render inert
waleedlatif1 8e6e18c
fix(tools): stop guard errors echoing the rejected value, and close t…
waleedlatif1 49c802f
test(supabase): pin both derived parameter groups, not just their total
waleedlatif1 c39f572
test(tools): bound the names-the-parameter match to whole words
waleedlatif1 b9f6367
test(bigquery): assert the body project id unconditionally
waleedlatif1 b43bbe3
test(supabase): track #7262 permitting a whitespace-only path component
waleedlatif1 e572bba
test(tools): single discovery sweep, and record why the assertions ar…
waleedlatif1 345ef7f
refactor(tools): use #7262's strictUrlPathSegment and delete the loca…
waleedlatif1 193d084
test(bigquery): compare URL and body to each other, not to two literals
waleedlatif1 c43998b
fix(tools): stop applying the strict guard to read routes
waleedlatif1 30f1579
test(bigquery): complete the exemption list and pin it
waleedlatif1 5e855a6
fix(supabase): trim a pasted storage key again, keep interior whitespace
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
21 changes: 19 additions & 2 deletions
21
apps/sim/lib/internal/supabase/operations/storage-get-public-url.ts
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * @vitest-environment node | ||
| * | ||
| * Contract for `namesParam`, the matcher behind every "names the parameter" | ||
| * assertion in the path-safety suites. | ||
| * | ||
| * It gets its own test because the assertion it powers is only as strong as it | ||
| * is, and the previous substring implementation passed all seven suites while | ||
| * accepting a message that named the **wrong** parameter. A weakness here is | ||
| * invisible everywhere else. | ||
| */ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { namesParam } from '@/tools/__tests__/path-safety' | ||
|
|
||
| describe('namesParam', () => { | ||
| it.each([ | ||
| ['projectId must not have leading or trailing whitespace', 'projectId'], | ||
| ['signRequestId must not have leading or trailing whitespace', 'signRequestId'], | ||
| ['bucket cannot contain a path separator', 'bucket'], | ||
| ['path cannot contain an empty or whitespace-only path segment', 'path'], | ||
| ['tableId cannot be "." (path traversal is not allowed)', 'tableId'], | ||
| ['Invalid table: must start with a letter or underscore', 'table'], | ||
| ])('accepts %j as naming %j', (message, paramName) => { | ||
| expect(namesParam(message, paramName)).toBe(true) | ||
| }) | ||
|
|
||
| /** | ||
| * A stricter service validator spells the name as prose. Joining adjacent | ||
| * tokens is what keeps that a correct naming rather than a near-miss. | ||
| */ | ||
| it('accepts a prose spelling split across words', () => { | ||
| expect(namesParam('Invalid function name: must contain only letters', 'functionName')).toBe( | ||
| true | ||
| ) | ||
| }) | ||
|
|
||
| /** Each of these was accepted by the previous substring implementation. */ | ||
| it.each([ | ||
| ['a generic message', 'Invalid input', 'id'], | ||
| ['a message naming a different parameter', 'projectId cannot be ".."', 'id'], | ||
| ['a longer parameter name containing this one', 'tableId cannot be "."', 'table'], | ||
| ['the name as a substring of an unrelated word', 'pathological failure', 'path'], | ||
| ])('rejects %s', (_label, message, paramName) => { | ||
| expect(namesParam(message, paramName)).toBe(false) | ||
| }) | ||
|
|
||
| it('rejects an unrelated message outright', () => { | ||
| expect(namesParam('Something went wrong', 'path')).toBe(false) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.