fix: escape delimiter characters in applyEscape to prevent SQL injection#2811
Conversation
…ent SQL injection The applyEscape() function wraps user-supplied template parameter values with delimiter characters (backticks, double quotes, single quotes, or square brackets) but does not escape those same delimiter characters within the value itself. This allows an attacker to break out of the quoted identifier and inject arbitrary SQL. For example, with backtick escaping configured: - Input: `users` OR 1=1--` - Before fix: `users` OR 1=1--`` (delimiter closed early, SQL injected) - After fix: `users`` OR 1=1--``` (backtick inside value is doubled) The fix applies standard SQL identifier escaping by doubling the delimiter character within the value before wrapping: - Backticks: ` → `` - Double quotes: " → "" - Single quotes: ' → '' - Square brackets: ] → ]] This matches the escaping conventions used by MySQL (backticks), PostgreSQL/ANSI SQL (double quotes), SQL Server (square brackets), and standard SQL (single quotes).
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical SQL injection vulnerability in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a critical SQL injection vulnerability by properly escaping delimiter characters in the applyEscape function. The method used, doubling the delimiter characters, is the standard approach for SQL. However, the changes lack corresponding unit tests to validate the fix for injection scenarios. It is highly recommended to add test cases that cover inputs containing the delimiter characters to prevent regressions and ensure the fix is robust.
Adds 4 test cases that verify delimiter characters within values are properly escaped (doubled) to prevent SQL injection: - Backtick in value: users` OR 1=1-- → `users`` OR 1=1--` - Double quote in value: col" OR 1=1-- → "col"" OR 1=1--" - Single quote in value: val' OR 1=1-- → 'val'' OR 1=1--' - Square bracket in value: col] OR 1=1-- → [col]] OR 1=1--]
|
Thank you for the PR. We will review shortly. |
dd58d8b to
18e01ee
Compare
…to prevent injection (#3219) ## Summary This PR fixes identifier-injection vulnerabilities in three built-in tools that interpolate caller-supplied parameters directly into SQL without sanitisation. --- ### 1. `clickhouse-list-tables` — database identifier injection (original fix) `Tool.Invoke` interpolates the caller-supplied `database` parameter directly into a `SHOW TABLES FROM %s` statement: ```go query := fmt.Sprintf("SHOW TABLES FROM %s", database) ``` The existing comment acknowledges the risk. The fix adds a `validIdentifier` regex (`^[A-Za-z_][A-Za-z0-9_]*$`) that must match before interpolation. Concrete payloads on a default ClickHouse deployment: | `database` parameter | rendered query | effect | |---|---|---| | `default LIKE '%secret%'` | `SHOW TABLES FROM default LIKE '%secret%'` | filters listing by attacker-chosen pattern | | `system FORMAT JSONEachRow` | `SHOW TABLES FROM system FORMAT JSONEachRow` | enumerates `system.*` (system.users, etc.) | | `default INTO OUTFILE '/tmp/x.tsv'` | `SHOW TABLES FROM default INTO OUTFILE '/tmp/x.tsv'` | writes to disk on ClickHouse host | --- ### 2. `bigquery-forecast` — backtick + column-name injection Two injection classes: **a. Backtick injection in `history_data` (table identifier path)** ```go historyDataSource = fmt.Sprintf("TABLE `%s`", historyData) ``` When `allowed_datasets` is not configured (the default), no validation runs before this line. An attacker-supplied `history_data` containing a backtick closes the opening delimiter and appends arbitrary SQL: ``` history_data = "ds.tbl` UNION ALL SELECT secret FROM private.pii --" → TABLE `ds.tbl` UNION ALL SELECT secret FROM private.pii --` ``` **b. Column-name injection in `data_col`, `timestamp_col`, `id_cols`** ```go sql := fmt.Sprintf(`... data_col => '%s', timestamp_col => '%s' ...`, dataCol, timestampCol, ...) ``` Column names are interpolated as single-quoted strings with no validation. A value containing `'` breaks out of the string literal context. **Fix:** `ValidTableID` (restricts `history_data` to `[a-zA-Z0-9_]+` components with 1–2 dots) applied in the table-ID else-branch; `ValidColumnName` (`^[a-zA-Z_][a-zA-Z0-9_]*$`) applied to `data_col`, `timestamp_col`, and each element of `id_cols`. --- ### 3. `bigquery-analyze-contribution` — backtick + OPTIONS injection **a. Backtick injection in `input_data` (table identifier path)** ```go inputDataSource = fmt.Sprintf("SELECT * FROM `%s`", inputData) ``` Same root cause as bigquery-forecast: when `allowed_datasets` is absent, no validation before interpolation. **b. Column-name and OPTIONS injection** ```go options = append(options, fmt.Sprintf("IS_TEST_COL = '%s'", paramsMap["is_test_col"])) // and each element of dimension_id_cols: strCols = append(strCols, fmt.Sprintf("'%s'", c)) ``` `is_test_col` and `dimension_id_cols` are column names interpolated into BigQuery ML `OPTIONS()` string literals without validation. `contribution_metric` (e.g. `SUM(col)/COUNT(DISTINCT col2)`) goes into `OPTIONS(CONTRIBUTION_METRIC = '%s')`. A single-quote in this value breaks the OPTIONS string literal. **Fix:** `ValidTableID` for `input_data` in the table-ID else-branch; `ValidColumnName` for `is_test_col` and each `dimension_id_cols` element; single-quote check for `contribution_metric`. --- ## Shared validators in `bigquerycommon` `ValidTableID` and `ValidColumnName` are exported from the `bigquerycommon` package so both tools share the same rules. Tests are in `validators_test.go`. ## Test plan - [x] `go build ./...` clean - [x] `go test ./internal/tools/bigquery/... -v` passes (all existing tests + new `TestValidTableID`, `TestValidColumnName`) - [x] `go test ./internal/tools/clickhouse/clickhouselisttables/... -v` passes ## Not a dupe of #2811 / #779 Those cover the `templateParameter` flow (`internal/util/parameters/parameters.go:applyEscape`). The three tools fixed here use hard-coded `fmt.Sprintf` interpolation in their own `Invoke` methods — none of the templateParameter mitigations apply. --------- Co-authored-by: Yuan Teoh <[email protected]>
|
/gcbrun |
averikitsch
left a comment
There was a problem hiding this comment.
We may need to make this database specific.
|
/gcbrun |
## Description Currently, the integration tests on Cloud Build suffer from regex evaluation and maintainability issues within `.ci/integration.cloudbuild.yaml`: 1. Core file and shared utility modifications (such as `internal/util/parameters/parameters.go` in #2811) skip many integration test shards because their `PATTERN` only looked for specific database source paths. 3. Shards like `mysql` and `mssql` used unanchored substring matching (`mysql|`), which accidentally triggered them whenever their Cloud SQL counterparts (`cloudsqlmysql`, `cloudsqlmssql`) were edited, leading to redundant/incorrect test runs. 4. Appending a massive core logic regex to 47 different shards creates a massive maintenance burden and violates DRY. ## Changes - Created a centralized `.ci/core_pattern.txt` file that contains core path regex (covering `internal/server/`, `internal/util/`, `internal/auth/`, etc.). - Every test shard now dynamically reads this via `$$(cat .ci/core_pattern.txt)`, cleaning up the YAML file. - Added Path Boundary Anchors `(^|/)` to all integration-specific regex terms (e.g., `mysql` is now `(^|/)mysql/`). - This eliminates substring leaks while preserving intentional file sharing (such as base `postgres/` changes correctly triggering `alloydb`, `alloydb-pg`, and `cloud-sql-pg` shards). ## Checklist - [ ] Make sure to open an issue as a bug/issue before writing your code! - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [x] Make sure to add `!` if this involves a breaking change
🤖 I have created a release *beep* *boop* --- ## [1.5.0](v1.4.0...v1.5.0) (2026-06-18) ### Features * **auth/google:** Require audience or clientId for mcpEnabled ([#3450](#3450)) ([59f7b6e](59f7b6e)) * Enable per source level flags for sql commenter ([#3465](#3465)) ([ecce6b7](ecce6b7)) * **mcp:** Add URL parameter binding for HTTP transport ([#3112](#3112)) ([0cc7b37](0cc7b37)) * **scylladb:** Adding support for ScyllaDB source and tool ([#3119](#3119)) ([2dada83](2dada83)) * **server:** Add support for toolset filtering in prebuilt CLI flag ([#3245](#3245)) ([7cc4f65](7cc4f65)) * **skills:** Generate skills offline without live source connections ([#3388](#3388)) ([4c860b6](4c860b6)) * **skills:** Tolerate missing env vars during offline skills-generate ([#3399](#3399)) ([ea5d3e5](ea5d3e5)) * **source/cloud-storage:** Restrict bucket and local path access ([#3454](#3454)) ([2c3ca5d](2c3ca5d)) * **tools/bigquery:** Add per tool query label in BigQuery jobs ([#1975](#1975)) ([3f6a49f](3f6a49f)) * **tools/dataplex:** Add tools to support metadata enrichment workflow ([#3270](#3270)) ([05289aa](05289aa)) * **tools/mysql:** Add show-query-stats and list-all-locks tools for MySQL and Cloud SQL MySQL source ([#2954](#2954)) ([a9693bd](a9693bd)) * **tools:** Decouple tool initialization from sources ([#3355](#3355)) ([32a24e3](32a24e3)) ### Bug Fixes * **auth/dataplex:** Fix failing source with service account credentials ([#3369](#3369)) ([ba4deef](ba4deef)) * **bigquery:** Wire maximumBytesBilled into prebuilt config ([#3385](#3385)) ([4abbf6e](4abbf6e)) * Bound MCP HTTP body size ([#3216](#3216)) ([d4f4342](d4f4342)) * **config:** Add doc/line context to parse errors ([#2957](#2957)) ([4b097da](4b097da)) * Escape delimiter characters in applyEscape to prevent SQL injection ([#2811](#2811)) ([932519a](932519a)) * **npm:** Source binary version from cmd/version.txt ([#3417](#3417)) ([6ffbdec](6ffbdec)) * **prebuilt/alloydb-omni:** Require password env var explicitly ([#3398](#3398)) ([fcbe3e7](fcbe3e7)) * **server:** Fail if MCP auth is enabled together with enable-api ([#3435](#3435)) ([a6ff910](a6ff910)) * **server:** Return errors instead of panicking in InitializeConfigs ([#3397](#3397)) ([f48b01d](f48b01d)) * **source/cloudhealthcare:** Validate pageURL parameter to prevent SSRF ([#3453](#3453)) ([9abf47d](9abf47d)) * **source/dataplex,source/datalineage:** Specify cloud-platform scope for default credentials ([#3376](#3376)) ([13e8c36](13e8c36)) * **source/http:** Implement SSRF guard ([#3448](#3448)) ([24d7d29](24d7d29)) * **tool/bigquery-execute-sql:** Prevent dataset restriction bypass ([#3452](#3452)) ([ca6d5e3](ca6d5e3)) * **tool/mysql-get-query-plan:** Prevent query execution bypass and statement injection ([#3235](#3235)) ([7ed1e7b](7ed1e7b)) * **tool/spanner-sql,tool/spanner-execute-sql:** Use read-only annotations when readOnly is set ([#3338](#3338)) ([8bde0ec](8bde0ec)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.5.0](v1.4.0...v1.5.0) (2026-06-18) ### Features * **auth/google:** Require audience or clientId for mcpEnabled ([#3450](#3450)) ([59f7b6e](59f7b6e)) * Enable per source level flags for sql commenter ([#3465](#3465)) ([ecce6b7](ecce6b7)) * **mcp:** Add URL parameter binding for HTTP transport ([#3112](#3112)) ([0cc7b37](0cc7b37)) * **scylladb:** Adding support for ScyllaDB source and tool ([#3119](#3119)) ([2dada83](2dada83)) * **server:** Add support for toolset filtering in prebuilt CLI flag ([#3245](#3245)) ([7cc4f65](7cc4f65)) * **skills:** Generate skills offline without live source connections ([#3388](#3388)) ([4c860b6](4c860b6)) * **skills:** Tolerate missing env vars during offline skills-generate ([#3399](#3399)) ([ea5d3e5](ea5d3e5)) * **source/cloud-storage:** Restrict bucket and local path access ([#3454](#3454)) ([2c3ca5d](2c3ca5d)) * **tools/bigquery:** Add per tool query label in BigQuery jobs ([#1975](#1975)) ([3f6a49f](3f6a49f)) * **tools/dataplex:** Add tools to support metadata enrichment workflow ([#3270](#3270)) ([05289aa](05289aa)) * **tools/mysql:** Add show-query-stats and list-all-locks tools for MySQL and Cloud SQL MySQL source ([#2954](#2954)) ([a9693bd](a9693bd)) * **tools:** Decouple tool initialization from sources ([#3355](#3355)) ([32a24e3](32a24e3)) ### Bug Fixes * **auth/dataplex:** Fix failing source with service account credentials ([#3369](#3369)) ([ba4deef](ba4deef)) * **bigquery:** Wire maximumBytesBilled into prebuilt config ([#3385](#3385)) ([4abbf6e](4abbf6e)) * Bound MCP HTTP body size ([#3216](#3216)) ([d4f4342](d4f4342)) * **config:** Add doc/line context to parse errors ([#2957](#2957)) ([4b097da](4b097da)) * Escape delimiter characters in applyEscape to prevent SQL injection ([#2811](#2811)) ([932519a](932519a)) * **npm:** Source binary version from cmd/version.txt ([#3417](#3417)) ([6ffbdec](6ffbdec)) * **prebuilt/alloydb-omni:** Require password env var explicitly ([#3398](#3398)) ([fcbe3e7](fcbe3e7)) * **server:** Fail if MCP auth is enabled together with enable-api ([#3435](#3435)) ([a6ff910](a6ff910)) * **server:** Return errors instead of panicking in InitializeConfigs ([#3397](#3397)) ([f48b01d](f48b01d)) * **source/cloudhealthcare:** Validate pageURL parameter to prevent SSRF ([#3453](#3453)) ([9abf47d](9abf47d)) * **source/dataplex,source/datalineage:** Specify cloud-platform scope for default credentials ([#3376](#3376)) ([13e8c36](13e8c36)) * **source/http:** Implement SSRF guard ([#3448](#3448)) ([24d7d29](24d7d29)) * **tool/bigquery-execute-sql:** Prevent dataset restriction bypass ([#3452](#3452)) ([ca6d5e3](ca6d5e3)) * **tool/mysql-get-query-plan:** Prevent query execution bypass and statement injection ([#3235](#3235)) ([7ed1e7b](7ed1e7b)) * **tool/spanner-sql,tool/spanner-execute-sql:** Use read-only annotations when readOnly is set ([#3338](#3338)) ([8bde0ec](8bde0ec)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <[email protected]> 45c0f86
🤖 I have created a release *beep* *boop* --- ## [1.5.0](googleapis/mcp-toolbox@v1.4.0...v1.5.0) (2026-06-18) ### Features * **auth/google:** Require audience or clientId for mcpEnabled ([googleapis#3450](googleapis#3450)) ([59f7b6e](googleapis@59f7b6e)) * Enable per source level flags for sql commenter ([googleapis#3465](googleapis#3465)) ([ecce6b7](googleapis@ecce6b7)) * **mcp:** Add URL parameter binding for HTTP transport ([googleapis#3112](googleapis#3112)) ([0cc7b37](googleapis@0cc7b37)) * **scylladb:** Adding support for ScyllaDB source and tool ([googleapis#3119](googleapis#3119)) ([2dada83](googleapis@2dada83)) * **server:** Add support for toolset filtering in prebuilt CLI flag ([googleapis#3245](googleapis#3245)) ([7cc4f65](googleapis@7cc4f65)) * **skills:** Generate skills offline without live source connections ([googleapis#3388](googleapis#3388)) ([4c860b6](googleapis@4c860b6)) * **skills:** Tolerate missing env vars during offline skills-generate ([googleapis#3399](googleapis#3399)) ([ea5d3e5](googleapis@ea5d3e5)) * **source/cloud-storage:** Restrict bucket and local path access ([googleapis#3454](googleapis#3454)) ([2c3ca5d](googleapis@2c3ca5d)) * **tools/bigquery:** Add per tool query label in BigQuery jobs ([googleapis#1975](googleapis#1975)) ([3f6a49f](googleapis@3f6a49f)) * **tools/dataplex:** Add tools to support metadata enrichment workflow ([googleapis#3270](googleapis#3270)) ([05289aa](googleapis@05289aa)) * **tools/mysql:** Add show-query-stats and list-all-locks tools for MySQL and Cloud SQL MySQL source ([googleapis#2954](googleapis#2954)) ([a9693bd](googleapis@a9693bd)) * **tools:** Decouple tool initialization from sources ([googleapis#3355](googleapis#3355)) ([32a24e3](googleapis@32a24e3)) ### Bug Fixes * **auth/dataplex:** Fix failing source with service account credentials ([googleapis#3369](googleapis#3369)) ([ba4deef](googleapis@ba4deef)) * **bigquery:** Wire maximumBytesBilled into prebuilt config ([googleapis#3385](googleapis#3385)) ([4abbf6e](googleapis@4abbf6e)) * Bound MCP HTTP body size ([googleapis#3216](googleapis#3216)) ([d4f4342](googleapis@d4f4342)) * **config:** Add doc/line context to parse errors ([googleapis#2957](googleapis#2957)) ([4b097da](googleapis@4b097da)) * Escape delimiter characters in applyEscape to prevent SQL injection ([googleapis#2811](googleapis#2811)) ([932519a](googleapis@932519a)) * **npm:** Source binary version from cmd/version.txt ([googleapis#3417](googleapis#3417)) ([6ffbdec](googleapis@6ffbdec)) * **prebuilt/alloydb-omni:** Require password env var explicitly ([googleapis#3398](googleapis#3398)) ([fcbe3e7](googleapis@fcbe3e7)) * **server:** Fail if MCP auth is enabled together with enable-api ([googleapis#3435](googleapis#3435)) ([a6ff910](googleapis@a6ff910)) * **server:** Return errors instead of panicking in InitializeConfigs ([googleapis#3397](googleapis#3397)) ([f48b01d](googleapis@f48b01d)) * **source/cloudhealthcare:** Validate pageURL parameter to prevent SSRF ([googleapis#3453](googleapis#3453)) ([9abf47d](googleapis@9abf47d)) * **source/dataplex,source/datalineage:** Specify cloud-platform scope for default credentials ([googleapis#3376](googleapis#3376)) ([13e8c36](googleapis@13e8c36)) * **source/http:** Implement SSRF guard ([googleapis#3448](googleapis#3448)) ([24d7d29](googleapis@24d7d29)) * **tool/bigquery-execute-sql:** Prevent dataset restriction bypass ([googleapis#3452](googleapis#3452)) ([ca6d5e3](googleapis@ca6d5e3)) * **tool/mysql-get-query-plan:** Prevent query execution bypass and statement injection ([googleapis#3235](googleapis#3235)) ([7ed1e7b](googleapis@7ed1e7b)) * **tool/spanner-sql,tool/spanner-execute-sql:** Use read-only annotations when readOnly is set ([googleapis#3338](googleapis#3338)) ([8bde0ec](googleapis@8bde0ec)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <[email protected]> 45c0f86
🤖 I have created a release *beep* *boop* --- ## [1.5.0](googleapis/mcp-toolbox@v1.4.0...v1.5.0) (2026-06-18) ### Features * **auth/google:** Require audience or clientId for mcpEnabled ([googleapis#3450](googleapis#3450)) ([59f7b6e](googleapis@59f7b6e)) * Enable per source level flags for sql commenter ([googleapis#3465](googleapis#3465)) ([ecce6b7](googleapis@ecce6b7)) * **mcp:** Add URL parameter binding for HTTP transport ([googleapis#3112](googleapis#3112)) ([0cc7b37](googleapis@0cc7b37)) * **scylladb:** Adding support for ScyllaDB source and tool ([googleapis#3119](googleapis#3119)) ([2dada83](googleapis@2dada83)) * **server:** Add support for toolset filtering in prebuilt CLI flag ([googleapis#3245](googleapis#3245)) ([7cc4f65](googleapis@7cc4f65)) * **skills:** Generate skills offline without live source connections ([googleapis#3388](googleapis#3388)) ([4c860b6](googleapis@4c860b6)) * **skills:** Tolerate missing env vars during offline skills-generate ([googleapis#3399](googleapis#3399)) ([ea5d3e5](googleapis@ea5d3e5)) * **source/cloud-storage:** Restrict bucket and local path access ([googleapis#3454](googleapis#3454)) ([2c3ca5d](googleapis@2c3ca5d)) * **tools/bigquery:** Add per tool query label in BigQuery jobs ([googleapis#1975](googleapis#1975)) ([3f6a49f](googleapis@3f6a49f)) * **tools/dataplex:** Add tools to support metadata enrichment workflow ([googleapis#3270](googleapis#3270)) ([05289aa](googleapis@05289aa)) * **tools/mysql:** Add show-query-stats and list-all-locks tools for MySQL and Cloud SQL MySQL source ([googleapis#2954](googleapis#2954)) ([a9693bd](googleapis@a9693bd)) * **tools:** Decouple tool initialization from sources ([googleapis#3355](googleapis#3355)) ([32a24e3](googleapis@32a24e3)) ### Bug Fixes * **auth/dataplex:** Fix failing source with service account credentials ([googleapis#3369](googleapis#3369)) ([ba4deef](googleapis@ba4deef)) * **bigquery:** Wire maximumBytesBilled into prebuilt config ([googleapis#3385](googleapis#3385)) ([4abbf6e](googleapis@4abbf6e)) * Bound MCP HTTP body size ([googleapis#3216](googleapis#3216)) ([d4f4342](googleapis@d4f4342)) * **config:** Add doc/line context to parse errors ([googleapis#2957](googleapis#2957)) ([4b097da](googleapis@4b097da)) * Escape delimiter characters in applyEscape to prevent SQL injection ([googleapis#2811](googleapis#2811)) ([932519a](googleapis@932519a)) * **npm:** Source binary version from cmd/version.txt ([googleapis#3417](googleapis#3417)) ([6ffbdec](googleapis@6ffbdec)) * **prebuilt/alloydb-omni:** Require password env var explicitly ([googleapis#3398](googleapis#3398)) ([fcbe3e7](googleapis@fcbe3e7)) * **server:** Fail if MCP auth is enabled together with enable-api ([googleapis#3435](googleapis#3435)) ([a6ff910](googleapis@a6ff910)) * **server:** Return errors instead of panicking in InitializeConfigs ([googleapis#3397](googleapis#3397)) ([f48b01d](googleapis@f48b01d)) * **source/cloudhealthcare:** Validate pageURL parameter to prevent SSRF ([googleapis#3453](googleapis#3453)) ([9abf47d](googleapis@9abf47d)) * **source/dataplex,source/datalineage:** Specify cloud-platform scope for default credentials ([googleapis#3376](googleapis#3376)) ([13e8c36](googleapis@13e8c36)) * **source/http:** Implement SSRF guard ([googleapis#3448](googleapis#3448)) ([24d7d29](googleapis@24d7d29)) * **tool/bigquery-execute-sql:** Prevent dataset restriction bypass ([googleapis#3452](googleapis#3452)) ([ca6d5e3](googleapis@ca6d5e3)) * **tool/mysql-get-query-plan:** Prevent query execution bypass and statement injection ([googleapis#3235](googleapis#3235)) ([7ed1e7b](googleapis@7ed1e7b)) * **tool/spanner-sql,tool/spanner-execute-sql:** Use read-only annotations when readOnly is set ([googleapis#3338](googleapis#3338)) ([8bde0ec](googleapis@8bde0ec)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <[email protected]> 45c0f86
🤖 I have created a release *beep* *boop* --- ## [1.5.0](googleapis/mcp-toolbox@v1.4.0...v1.5.0) (2026-06-18) ### Features * **auth/google:** Require audience or clientId for mcpEnabled ([googleapis#3450](googleapis#3450)) ([59f7b6e](googleapis@59f7b6e)) * Enable per source level flags for sql commenter ([googleapis#3465](googleapis#3465)) ([ecce6b7](googleapis@ecce6b7)) * **mcp:** Add URL parameter binding for HTTP transport ([googleapis#3112](googleapis#3112)) ([0cc7b37](googleapis@0cc7b37)) * **scylladb:** Adding support for ScyllaDB source and tool ([googleapis#3119](googleapis#3119)) ([2dada83](googleapis@2dada83)) * **server:** Add support for toolset filtering in prebuilt CLI flag ([googleapis#3245](googleapis#3245)) ([7cc4f65](googleapis@7cc4f65)) * **skills:** Generate skills offline without live source connections ([googleapis#3388](googleapis#3388)) ([4c860b6](googleapis@4c860b6)) * **skills:** Tolerate missing env vars during offline skills-generate ([googleapis#3399](googleapis#3399)) ([ea5d3e5](googleapis@ea5d3e5)) * **source/cloud-storage:** Restrict bucket and local path access ([googleapis#3454](googleapis#3454)) ([2c3ca5d](googleapis@2c3ca5d)) * **tools/bigquery:** Add per tool query label in BigQuery jobs ([googleapis#1975](googleapis#1975)) ([3f6a49f](googleapis@3f6a49f)) * **tools/dataplex:** Add tools to support metadata enrichment workflow ([googleapis#3270](googleapis#3270)) ([05289aa](googleapis@05289aa)) * **tools/mysql:** Add show-query-stats and list-all-locks tools for MySQL and Cloud SQL MySQL source ([googleapis#2954](googleapis#2954)) ([a9693bd](googleapis@a9693bd)) * **tools:** Decouple tool initialization from sources ([googleapis#3355](googleapis#3355)) ([32a24e3](googleapis@32a24e3)) ### Bug Fixes * **auth/dataplex:** Fix failing source with service account credentials ([googleapis#3369](googleapis#3369)) ([ba4deef](googleapis@ba4deef)) * **bigquery:** Wire maximumBytesBilled into prebuilt config ([googleapis#3385](googleapis#3385)) ([4abbf6e](googleapis@4abbf6e)) * Bound MCP HTTP body size ([googleapis#3216](googleapis#3216)) ([d4f4342](googleapis@d4f4342)) * **config:** Add doc/line context to parse errors ([googleapis#2957](googleapis#2957)) ([4b097da](googleapis@4b097da)) * Escape delimiter characters in applyEscape to prevent SQL injection ([googleapis#2811](googleapis#2811)) ([932519a](googleapis@932519a)) * **npm:** Source binary version from cmd/version.txt ([googleapis#3417](googleapis#3417)) ([6ffbdec](googleapis@6ffbdec)) * **prebuilt/alloydb-omni:** Require password env var explicitly ([googleapis#3398](googleapis#3398)) ([fcbe3e7](googleapis@fcbe3e7)) * **server:** Fail if MCP auth is enabled together with enable-api ([googleapis#3435](googleapis#3435)) ([a6ff910](googleapis@a6ff910)) * **server:** Return errors instead of panicking in InitializeConfigs ([googleapis#3397](googleapis#3397)) ([f48b01d](googleapis@f48b01d)) * **source/cloudhealthcare:** Validate pageURL parameter to prevent SSRF ([googleapis#3453](googleapis#3453)) ([9abf47d](googleapis@9abf47d)) * **source/dataplex,source/datalineage:** Specify cloud-platform scope for default credentials ([googleapis#3376](googleapis#3376)) ([13e8c36](googleapis@13e8c36)) * **source/http:** Implement SSRF guard ([googleapis#3448](googleapis#3448)) ([24d7d29](googleapis@24d7d29)) * **tool/bigquery-execute-sql:** Prevent dataset restriction bypass ([googleapis#3452](googleapis#3452)) ([ca6d5e3](googleapis@ca6d5e3)) * **tool/mysql-get-query-plan:** Prevent query execution bypass and statement injection ([googleapis#3235](googleapis#3235)) ([7ed1e7b](googleapis@7ed1e7b)) * **tool/spanner-sql,tool/spanner-execute-sql:** Use read-only annotations when readOnly is set ([googleapis#3338](googleapis#3338)) ([8bde0ec](googleapis@8bde0ec)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <[email protected]> 45c0f86
🤖 I have created a release *beep* *boop* --- ## [1.5.0](googleapis/mcp-toolbox@v1.4.0...v1.5.0) (2026-06-18) ### Features * **auth/google:** Require audience or clientId for mcpEnabled ([googleapis#3450](googleapis#3450)) ([59f7b6e](googleapis@59f7b6e)) * Enable per source level flags for sql commenter ([googleapis#3465](googleapis#3465)) ([ecce6b7](googleapis@ecce6b7)) * **mcp:** Add URL parameter binding for HTTP transport ([googleapis#3112](googleapis#3112)) ([0cc7b37](googleapis@0cc7b37)) * **scylladb:** Adding support for ScyllaDB source and tool ([googleapis#3119](googleapis#3119)) ([2dada83](googleapis@2dada83)) * **server:** Add support for toolset filtering in prebuilt CLI flag ([googleapis#3245](googleapis#3245)) ([7cc4f65](googleapis@7cc4f65)) * **skills:** Generate skills offline without live source connections ([googleapis#3388](googleapis#3388)) ([4c860b6](googleapis@4c860b6)) * **skills:** Tolerate missing env vars during offline skills-generate ([googleapis#3399](googleapis#3399)) ([ea5d3e5](googleapis@ea5d3e5)) * **source/cloud-storage:** Restrict bucket and local path access ([googleapis#3454](googleapis#3454)) ([2c3ca5d](googleapis@2c3ca5d)) * **tools/bigquery:** Add per tool query label in BigQuery jobs ([googleapis#1975](googleapis#1975)) ([3f6a49f](googleapis@3f6a49f)) * **tools/dataplex:** Add tools to support metadata enrichment workflow ([googleapis#3270](googleapis#3270)) ([05289aa](googleapis@05289aa)) * **tools/mysql:** Add show-query-stats and list-all-locks tools for MySQL and Cloud SQL MySQL source ([googleapis#2954](googleapis#2954)) ([a9693bd](googleapis@a9693bd)) * **tools:** Decouple tool initialization from sources ([googleapis#3355](googleapis#3355)) ([32a24e3](googleapis@32a24e3)) ### Bug Fixes * **auth/dataplex:** Fix failing source with service account credentials ([googleapis#3369](googleapis#3369)) ([ba4deef](googleapis@ba4deef)) * **bigquery:** Wire maximumBytesBilled into prebuilt config ([googleapis#3385](googleapis#3385)) ([4abbf6e](googleapis@4abbf6e)) * Bound MCP HTTP body size ([googleapis#3216](googleapis#3216)) ([d4f4342](googleapis@d4f4342)) * **config:** Add doc/line context to parse errors ([googleapis#2957](googleapis#2957)) ([4b097da](googleapis@4b097da)) * Escape delimiter characters in applyEscape to prevent SQL injection ([googleapis#2811](googleapis#2811)) ([932519a](googleapis@932519a)) * **npm:** Source binary version from cmd/version.txt ([googleapis#3417](googleapis#3417)) ([6ffbdec](googleapis@6ffbdec)) * **prebuilt/alloydb-omni:** Require password env var explicitly ([googleapis#3398](googleapis#3398)) ([fcbe3e7](googleapis@fcbe3e7)) * **server:** Fail if MCP auth is enabled together with enable-api ([googleapis#3435](googleapis#3435)) ([a6ff910](googleapis@a6ff910)) * **server:** Return errors instead of panicking in InitializeConfigs ([googleapis#3397](googleapis#3397)) ([f48b01d](googleapis@f48b01d)) * **source/cloudhealthcare:** Validate pageURL parameter to prevent SSRF ([googleapis#3453](googleapis#3453)) ([9abf47d](googleapis@9abf47d)) * **source/dataplex,source/datalineage:** Specify cloud-platform scope for default credentials ([googleapis#3376](googleapis#3376)) ([13e8c36](googleapis@13e8c36)) * **source/http:** Implement SSRF guard ([googleapis#3448](googleapis#3448)) ([24d7d29](googleapis@24d7d29)) * **tool/bigquery-execute-sql:** Prevent dataset restriction bypass ([googleapis#3452](googleapis#3452)) ([ca6d5e3](googleapis@ca6d5e3)) * **tool/mysql-get-query-plan:** Prevent query execution bypass and statement injection ([googleapis#3235](googleapis#3235)) ([7ed1e7b](googleapis@7ed1e7b)) * **tool/spanner-sql,tool/spanner-execute-sql:** Use read-only annotations when readOnly is set ([googleapis#3338](googleapis#3338)) ([8bde0ec](googleapis@8bde0ec)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <[email protected]> 45c0f86
Summary
The
applyEscape()function ininternal/util/parameters/parameters.gowraps user-supplied template parameter values with delimiter characters (backticks, double quotes, single quotes, or square brackets) but does not escape those same delimiter characters within the value itself. This allows an attacker to break out of the quoted identifier and inject arbitrary SQL.Security Impact
applyEscapeis the documented mitigation for SQL injection in template parameters:However, this mitigation is broken because delimiter characters inside the value are not escaped.
Example (backtick escaping)
Attack input:
users` WHERE 1=1 UNION SELECT * FROM credentials--Before fix (VULNERABLE):
The backtick in the input closes the identifier early, injecting arbitrary SQL.
After fix (SAFE):
The backtick inside the value is doubled, keeping the identifier intact.
The Fix
Standard SQL identifier escaping — double the delimiter character within the value before wrapping:
`` →``"" → ""'' → '']] → ]]Affected Code
internal/util/parameters/parameters.go, lines 783-796