Skip to content

fix: ensure correct escaping in advisor - #407

Merged
staaldraad merged 2 commits into
mainfrom
etienne/sec-960
Sep 3, 2026
Merged

fix: ensure correct escaping in advisor#407
staaldraad merged 2 commits into
mainfrom
etienne/sec-960

Conversation

@staaldraad

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Table names were not escaped in rls advisor.

What is the new behavior?

Escapes table names to ensure valid SQL in the suggested ALTER TABLE statement.

@staaldraad
staaldraad requested a review from a team as a code owner September 3, 2026 11:04
@coveralls

coveralls commented Sep 3, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 33747935731

Coverage decreased (-0.01%) to 96.454%

Details

  • Coverage decreased (-0.01%) from the base build.
  • Patch coverage: 14 of 14 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3388
Covered Lines: 3286
Line Coverage: 96.99%
Relevant Branches: 475
Covered Branches: 440
Branch Coverage: 92.63%
Branches in Coverage %: Yes
Coverage Strength: 58.04 hits per line

💛 - Coveralls

@raulb raulb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you also for updating the mgmt-api types 🙇‍♂️

@staaldraad
staaldraad merged commit a6cf4a0 into main Sep 3, 2026
6 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Sep 3, 2026
* schema and table portions independently.
*/
function quoteQualifiedName(name: string): string {
const dotIndex = name.indexOf('.');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting on the first dot loses the schema boundary, and the filter below has the same ambiguity. For { schema: "my.app", name: "users" }, this generates "my"."app.users"; a schema such as auth.legacy is also treated as auth and hidden. Could this use the original schema and name fields for both filtering and SQL?

@barryroodt barryroodt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! The identifier escaping fix looks correct. One minor issue remains: joining schema and name, then splitting on the first dot, breaks remediation SQL for schemas such as my.app. Could we pass { schema, name, rls_enabled } into buildRlsDisabledAdvisory, use the separate fields for filtering and SQL, and keep ${schema}.${name} only for display?

@staaldraad

Copy link
Copy Markdown
Member Author

Nice work! The identifier escaping fix looks correct. One minor issue remains: joining schema and name, then splitting on the first dot, breaks remediation SQL for schemas such as my.app. Could we pass { schema, name, rls_enabled } into buildRlsDisabledAdvisory, use the separate fields for filtering and SQL, and keep ${schema}.${name} only for display?

Good catch! Makes sense, I'll see trace back the call path and do as suggested. It will cleanup some other schema checks we have in that same code block that also splits on the first .

@staaldraad
staaldraad deleted the etienne/sec-960 branch September 3, 2026 12:57
@staaldraad

Copy link
Copy Markdown
Member Author

Could we pass { schema, name, rls_enabled } into buildRlsDisabledAdvisory, use the separate fields for filtering and SQL, and keep ${schema}.${name} only for display?

Primitives are already built into the code, use them: #409

staaldraad added a commit that referenced this pull request Sep 3, 2026
## What kind of change does this PR introduce?

chore / fix

## What is the current behavior?

Schemas are expected to never contain a `.` (dot)

## What is the new behavior?

Schemas may contain a `.` (dot) and will be treated the same as a schema
without.

Extends #407
barryroodt pushed a commit that referenced this pull request Sep 4, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-utils: 0.8.0</summary>

##
[0.8.0](mcp-utils-v0.7.0...mcp-utils-v0.8.0)
(2026-09-04)


### Features

* **mcp:** add project cost confirmation elicitation
([#391](#391))
([fb50882](fb50882))
* **mcp:** hide legacy cost tools from form-capable clients
([#411](#411))
([2f04461](2f04461))
</details>

<details><summary>mcp-server-supabase: 0.12.0</summary>

##
[0.12.0](mcp-server-supabase-v0.11.0...mcp-server-supabase-v0.12.0)
(2026-09-04)


### Features

* group lints in `get_advisors` response
([#390](#390))
([48d593a](48d593a))
* **mcp:** add branch cost confirmation elicitation
([#394](#394))
([867a160](867a160))
* **mcp:** add project cost confirmation elicitation
([#391](#391))
([fb50882](fb50882))
* **mcp:** hide legacy cost tools from form-capable clients
([#411](#411))
([2f04461](2f04461))


### Bug Fixes

* ensure correct escaping in advisor
([#407](#407))
([a6cf4a0](a6cf4a0))
* make server instructions intent-based instead of naming tools
([#372](#372))
([fc54ea2](fc54ea2))
</details>

---
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: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants