-
Notifications
You must be signed in to change notification settings - Fork 12
Release 21.0 Patch Update from upstream #198
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
Conversation
…d of calling `curl`. (vitessio#18650) (vitessio#18651) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
…hat don't cover the full range (vitessio#18641) (vitessio#18653) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Arthur Schreiber <[email protected]>
…o#18579) (vitessio#18631) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Arthur Schreiber <[email protected]>
) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
…18659) (vitessio#18661) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
…essio#18667) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
…) (vitessio#18669) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]>
…o#18681) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
…eturns (vitessio#18689) (vitessio#18704) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
…on (vitessio#18713) (vitessio#18720) Signed-off-by: Arthur Schreiber <[email protected]> Signed-off-by: Matt Lord <[email protected]> Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Co-authored-by: Matt Lord <[email protected]>
…ness (vitessio#18722) (vitessio#18723) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
…definitions when EnableViews is disabled (vitessio#18734) Signed-off-by: Harshit Gangal <[email protected]>
…ations. (vitessio#18736) (vitessio#18745) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
…18790) (vitessio#18792) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
…ps` RPC (vitessio#18814) (vitessio#18816) Signed-off-by: Tim Vaillancourt <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Tim Vaillancourt <[email protected]>
…inary for lastpk (vitessio#18852) (vitessio#18857) Signed-off-by: Nick Van Wiggeren <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
| return nil, fmt.Errorf("failed to parse backup path %q: %w", path, err) | ||
| } | ||
|
|
||
| fi, err := os.ReadDir(path) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To mitigate this vulnerability robustly:
- We must validate any user-controllable inputs (e.g.,
keyspaceandshard) to ensure they do not contain path separators or.., and ideally, are a single path component. - The best location for this validation is in
grpcvtctldserver/server.gowithin theGetBackupshandler (lines 1459 onward; specifically, before usingfilepath.Join(req.Keyspace, req.Shard)) since all paths downstream rely on this. This prevents any invalidkeyspace/shardvalue from being used in a path, regardless of backup engine or underlying storage. - Add a helper function (private to the file) to encapsulate this validation, checking for the presence of
/,\, or..inkeyspaceandshard. Return an error if the input is invalid. - Use this function before constructing the bucket path.
Files/Regions to change:
go/vt/vtctl/grpcvtctldserver/server.go:- Add validation to
GetBackupsfor bothreq.Keyspaceandreq.Shardbefore joining into a path. - Add a new validation helper if one is not already present.
- Add validation to
Methods/Imports/Definitions needed:
- Add a
validatePathComponenthelper function. - Import
"strings"if not already present (already present).
-
Copy modified lines R83-R93 -
Copy modified lines R1476-R1483
| @@ -80,6 +80,17 @@ | ||
| "vitess.io/vitess/go/vt/vttablet/tmclient" | ||
| ) | ||
|
|
||
| // validatePathComponent ensures the given string does not contain path separators or parent directory references. | ||
| func validatePathComponent(component string) error { | ||
| if component == "" { | ||
| return errors.New("component is empty") | ||
| } | ||
| if strings.Contains(component, "/") || strings.Contains(component, "\\") || strings.Contains(component, "..") { | ||
| return fmt.Errorf("component %q must not contain '/' '\\' or '..'", component) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| const ( | ||
| initShardPrimaryOperation = "InitShardPrimary" | ||
|
|
||
| @@ -1462,6 +1473,14 @@ | ||
|
|
||
| defer panicHandler(&err) | ||
|
|
||
| // Validate keyspace and shard to ensure they are single, safe path components. | ||
| if err := validatePathComponent(req.Keyspace); err != nil { | ||
| return nil, fmt.Errorf("invalid keyspace name: %v", err) | ||
| } | ||
| if err := validatePathComponent(req.Shard); err != nil { | ||
| return nil, fmt.Errorf("invalid shard name: %v", err) | ||
| } | ||
|
|
||
| span.Annotate("keyspace", req.Keyspace) | ||
| span.Annotate("shard", req.Shard) | ||
| span.Annotate("limit", req.Limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors GitHub Actions workflow execution by replacing manual skip logic with native GitHub Actions triggers. The changes include removing custom workflow skip steps, updating action versions, adding OS optimizations, upgrading MySQL APT repository package versions, fixing a bug in shard range generation, implementing connection pool close handling, adding security improvements for file path operations, and supporting tuple bind variables in SQL evaluation.
Key changes:
- Replaced manual workflow skip logic with declarative
ontriggers for branches/tags - Updated
actions/setup-gofrom v5.0.2 to v5.5.0 across all workflows - Fixed off-by-one error in
GenerateShardRangesfunction - Enhanced connection pool closure to prevent deadlocks
- Added path traversal protection using
SafePathJoin - Implemented tuple bind variable support in evalengine
Reviewed Changes
Copilot reviewed 134 out of 134 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Test templates (unit_test.tpl, cluster_*.tpl) | Replaced on: [push, pull_request] with explicit branch/tag triggers and removed skip-workflow steps |
| GitHub workflow files (.github/workflows/*.yml) | Applied template changes to generated workflows, updated setup-go action version |
| go/vt/key/key.go | Fixed loop condition in GenerateShardRanges to prevent off-by-one error |
| go/pools/smartconnpool/*.go | Refactored waitlist and pool closure to handle context cancellation properly |
| go/vt/mysqlctl/filebackupstorage/file.go | Added SafePathJoin for path traversal protection |
| go/fileutil/join.go | New utility for safe path joining |
| go/vt/vtgate/evalengine/*.go | Added support for tuple bind variables in IN expressions |
| Database schema files | Updated column types for better scalability |
| MAINTAINERS.md | Updated maintainer list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| shardRanges := make([]string, 0, shards) | ||
|
|
||
| for i := 1; i <= shards; i++ { | ||
| for i := 1; i < shards; i++ { |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop condition i < shards correctly fixes the off-by-one error that was present in the original code (i <= shards). The original bug would generate shards + 1 ranges instead of shards ranges. The fix ensures exactly shards ranges are generated by iterating from 1 to shards-1, then appending the final range after the loop.
Description
Related Issue(s)
Checklist
Deployment Notes