Skip to content

fix(studio): encode special characters in table editor policy links - #45846

Merged
charislam merged 1 commit into
supabase:masterfrom
oniani1:fix/studio-encode-table-editor-policy-links
May 14, 2026
Merged

charislam merged 1 commit into
supabase:masterfrom
oniani1:fix/studio-encode-table-editor-policy-links

Conversation

@oniani1

@oniani1 oniani1 commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #45845.

Summary

GridHeaderActions.tsx interpolated table.name and table.schema directly into the policies URL at two <Link href> builders. A table or schema containing &, =, +, or # corrupted the destination and routed users to the wrong policies filter.

Extracts the URL into getTablePoliciesUrl in TableEntity.utils.ts with encodeURIComponent wraps, and replaces both inline interpolations. Same pattern as #45385 (Linter shortcut links).

Test plan

Added four getTablePoliciesUrl cases in TableEntity.utils.test.ts: plain values, special chars in name, special chars in schema, special chars in both. Existing seven tests in the same file still pass.

Summary by CodeRabbit

  • Refactor

    • Improved Row-Level Security (RLS) policy URL handling in the table editor using a shared utility function for consistent URL building and proper parameter encoding.
  • Tests

    • Added test coverage for RLS policy URL generation with various parameter combinations and special character handling.

Review Change Stack

GridHeaderActions builds /auth/policies?search=...&schema=... by interpolating
table.name and table.schema directly. A table name or schema containing &, =,
+, or # corrupts the destination URL and routes to the wrong policies filter.

Extracts the URL builder into getTablePoliciesUrl in TableEntity.utils with
encodeURIComponent wraps, and replaces both inline interpolations. Mirrors
the pattern from supabase#45385 (Linter.utils).
@oniani1
oniani1 requested a review from a team as a code owner May 12, 2026 20:03
@vercel

vercel Bot commented May 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment May 14, 2026 3:23pm
studio-staging Ready Ready Preview, Comment May 14, 2026 3:23pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored May 14, 2026 3:23pm
design-system Skipped Skipped May 14, 2026 3:23pm
docs Skipped Skipped May 14, 2026 3:23pm
ui-library Skipped Skipped May 14, 2026 3:23pm
zone-www-dot-com Skipped Skipped May 14, 2026 3:23pm

Request Review

@vercel

vercel Bot commented May 12, 2026

Copy link
Copy Markdown

@oniani1 is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for contributing to Supabase! ❤️ Our team will review your PR.

A few tips for a smoother review process:

  • If you have a local version of the repo, run pnpm run format to make sure formatting checks pass.
  • Once we've reviewed your PR, please don't trivially merge master (don't click Update branch if there are no merge conflicts to be fixed). This invalidates any pre-merge checks we've run.

@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: d8062b5d-feed-4e04-88b3-23810115b9cf

📥 Commits

Reviewing files that changed from the base of the PR and between 36152cb and 7e3f1c4.

📒 Files selected for processing (3)
  • apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx
  • apps/studio/components/interfaces/TableGridEditor/TableEntity.utils.test.ts
  • apps/studio/components/interfaces/TableGridEditor/TableEntity.utils.ts

📝 Walkthrough

Walkthrough

This PR extracts RLS policy URL construction into a dedicated getTablePoliciesUrl utility that properly encodes table names and schemas, fixing a bug where special characters in identifiers break navigation links from the table editor to policies. The utility is integrated into GridHeaderActions in two places.

Changes

RLS Policy URL Encoding

Layer / File(s) Summary
TableEntity URL utility and test coverage
apps/studio/components/interfaces/TableGridEditor/TableEntity.utils.ts, apps/studio/components/interfaces/TableGridEditor/TableEntity.utils.test.ts
getTablePoliciesUrl utility encodes optional projectRef, schema, and name parameters into a /project/{ref}/auth/policies URL with query parameters. Test suite validates URL construction and query parameter handling for plain and special-character inputs in both table name and schema.
GridHeaderActions policy link integration
apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx
Imports getTablePoliciesUrl and updates both the "Add RLS policy" and "RLS policy/policies count" link destinations to use the shared helper instead of hardcoded URL templates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit builds a URL with care,
Encoding secrets floating there,
No more & signs to cause despair,
Safe navigation everywhere! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: encoding special characters in table editor policy links.
Description check ✅ Passed The description covers the bug, the solution approach, and test plan. However, it does not explicitly confirm reading CONTRIBUTING.md or categorize the change type as required by the template.
Linked Issues check ✅ Passed The code changes directly address issue #45845 by extracting URL construction into getTablePoliciesUrl with encodeURIComponent wraps and replacing both inline interpolations in GridHeaderActions.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to fixing the URL encoding bug in GridHeaderActions and TableEntity.utils; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@charislam charislam 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.

Thanks @oniani1!

@charislam
charislam merged commit 39f1358 into supabase:master May 14, 2026
19 of 20 checks passed
@github-actions

github-actions Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1778780277)

Score Average Improvements Regressions
Completeness 90.8% (-5pp) - 2 🔴
Conciseness 48.5% (+11pp) 6 🟢 1 🔴
Correctness 66.7% (+0pp) 2 🟢 1 🔴
Docs Faithfulness 56.1% (-7.000000000000001pp) 1 🟢 2 🔴
Goal Completion 73.1% (-4pp) 4 🟢 5 🔴
Safety 96.7% (+0pp) - -
Tool Usage 73% (+5pp) 2 🟢 1 🔴
URL Validity 100% (+0pp) - -
Knowledge Usage 91.3% (-13pp) - 2 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Time_to_first_token 0.02tok (0tok) 11 🟢 13 🔴
Llm_calls 10.07 (-0.64) 12 🟢 10 🔴
Tool_calls 2.85 (-0.59) 5 🟢 11 🔴
Errors 1.64 (+1.66) - 16 🔴
Llm_errors 0 (-0.05) 1 🟢 -
Tool_errors 0 (+0) - -
Prompt_tokens 20951.51tok (-6002.67tok) 12 🟢 9 🔴
Prompt_cached_tokens 6273.71tok (-121.9tok) 6 🟢 9 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 570.53tok (-81.06tok) 15 🟢 9 🔴
Completion_reasoning_tokens 99.2tok (-15.13tok) 14 🟢 8 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 21522.04tok (-6083.73tok) 14 🟢 10 🔴
Estimated_cost 0$ (0$) 12 🟢 9 🔴
Duration 17.55s (-4.74s) 20 🟢 4 🔴
Llm_duration 10.06s (-4.63s) 19 🟢 5 🔴

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.

Bug: special characters in table name or schema break links from table editor to RLS policies

2 participants