test(mcp-server-supabase): list_tables system schema assertions in server.database.test.ts are vacuous
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- postgresql, supabase, typescript
- Domain
- testing-qa
Research direction
Start in packages/mcp-server-supabase/src/server.database.test.ts around lines 1014–1028, where the three not.toEqual(expect.arrayContaining(...)) assertions on the list_tables result live. Check how list_tables builds the name field in database-operation-tools.ts. Replace the vacuous assertions with a check on result.tables that no name starts with pg_catalog., information_schema., or pg_toast., then run the server.database test file to confirm it passes and would fail if system tables were included.
Written by the indexing model from the issue text.
Description
Description
In packages/mcp-server-supabase/src/server.database.test.ts (lines 1014–1028), the test intended to verify that default list_tables calls do not leak system schemas (pg_catalog, information_schema, pg_toast) contains vacuous assertions that pass unconditionally.
Code Reference
// packages/mcp-server-supabase/src/server.database.test.ts
const result = await callTool({
name: 'list_tables',
arguments: {
project_id: project.id,
},
});
expect(result).not.toEqual(
expect.arrayContaining([
expect.objectContaining({ schema: 'pg_catalog' }),
])
);
expect(result).not.toEqual(
expect.arrayContaining([
expect.objectContaining({ schema: 'information_schema' }),
])
);
expect(result).not.toEqual(
expect.arrayContaining([expect.objectContaining({ schema: 'pg_toast' })])
);
Why it passes vacuously
- Object vs. Array comparison:
callToolreturns an object of shape{ tables: Array<{ name: string, ... }>, advisory?: ... }. Comparing an object againstexpect.arrayContaining(...)under.not.toEqual(...)always passes because an object is never an array. - Missing
schemaproperty: Indatabase-operation-tools.ts,list_tablesflattens the schema into thenamefield (e.g.public.usersorpg_catalog.pg_class). No table object intableshas a top-levelschemakey.
As a result, if list_tables were accidentally modified to include pg_catalog or other system tables in result.tables, this test would still pass green.
Reproduction
// Minimal demonstration of the assertion behavior
import { expect } from 'vitest';
const result = {
tables: [
{ name: 'pg_catalog.pg_class', rls_enabled: false },
{ name: 'information_schema.tables', rls_enabled: false },
],
};
// Both pass vacuously despite system tables being present in result.tables:
expect(result).not.toEqual(
expect.arrayContaining([expect.objectContaining({ schema: 'pg_catalog' })])
);
expect(result).not.toEqual(
expect.arrayContaining([expect.objectContaining({ schema: 'information_schema' })])
);
Proposed Fix
Assert directly on result.tables matching against the table names:
const systemSchemas = ['pg_catalog.', 'information_schema.', 'pg_toast.'];
for (const prefix of systemSchemas) {
expect(result.tables.some((t: { name: string }) => t.name.startsWith(prefix))).toBe(false);
}
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 432
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 52
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/mcp
-
postgrestRequest returns PostgREST error responses as successful resultsPossibly taken @irisfield claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Let execute_sql run as a project role you choosePossibly taken @barryroodt claimed this 5 days ago. Open
supabase/mcp#537 · 1 assignee ·
Maintainers usually reply within 1 day
-
execute_sql runs MERGE ... WHEN MATCHED THEN DELETE without the destructive confirmationPossibly taken @barryroodt claimed this 5 days ago. OpenMCP
Difficulty 3/5 1-2 days Newbie friendliness 69/100
supabase/mcp#532 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
list_tables: schemas says it defaults to all schemas but defaults to ["public"], so the RLS advisory silently reports on a partial databasePossibly taken @PranshulSoni claimed this 75 days ago. Openbug MCP
Difficulty 4/5 3-5 days Newbie friendliness 55/100
supabase/mcp#395 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Feature MCP
Difficulty 3/5 1-2 days Newbie friendliness 65/100
supabase/mcp#361 · 3 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Wallet functions throws TypeError when the wallet has no account IDPossibly taken @Medhansh-741 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
hiero-ledger/hiero-sdk-js#4781 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dataforgoodfr/mediterranean-rescue#91 ·
Maintainers usually reply within 1 day
-
transformer-directives: `@apply` drops a utility whose CSS is a substring of an earlier one'sPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Add: KRT TVOpenapproved check:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 65/100
iptv-org/iptv#58647 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
milind-soni/OpenMausBot#5829 ·
Maintainers usually reply within 1 day