Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/yudefine/nuxt-supabase-starter/auth-data-path-consistencygit clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starterWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/auth-data-path-consistency)<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/auth-data-path-consistency"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/auth-data-path-consistency.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02261 |
| Opus 5 | $0.00000 | $0.01130 |
| Sonnet 5 | $0.00000 | $0.00452 |
| Haiku 4.5 | $0.00000 | $0.00226 |
Grade A, and why
auth-data-path-consistency scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Auth–Data Path 一致性
核心命題
瀏覽器的 Supabase client(useSupabaseClient())向 PostgREST 發 request 時,身分來自 Supabase Auth 的 JWT,不來自應用程式自己的 Cookie Session。若應用程式已移除或未使用 Supabase Auth(改用 nuxt-auth-utils、Better Auth 等),瀏覽器的 Supabase client 永遠以 anon role 存取,無論使用者是否已登入。
此規則防止「session 層已換、但 client 端仍直連 PostgREST」的混合狀態—— 2026-07-14 production 401 事故的根因。
Trigger
- 更換或移除 auth 策略(Supabase Auth → nuxt-auth-utils / Better Auth,或反向)
- 新增 client-side
useSupabaseClient().from('table')直連查詢 - 新增 migration 含 RLS policy(
CREATE POLICY ... TO authenticated) - 新增 table 並決定 client 端存取方式
MUST
- 換 auth 策略時全面 audit call sites——列舉全部
useSupabaseClient()在app/的使用點,逐一歸類:- 改走 server API(
$fetch/useFetch) - 確認為純 Storage(
supabase.storage.from())——Storage 有獨立 bucket policy,不受此規則約束 - 確認仍有 Supabase Auth JWT 支撐(identity 來源未變)
- 改走 server API(
- Migration 建 RLS policy 時同時驗證 GRANT——PostgreSQL 先查 table-level privilege 再評估 RLS policy。只建
TO authenticatedpolicy 但沒有GRANT SELECT ON <table> TO authenticated,結果是42501(permission denied),RLS policy 完全不被評估。Migration 內 MUST 顯式 GRANT 或註明 table 已有既存 GRANT。 - 新增繞過 server 的資料路徑時標註 evlog 盲區——client-side PostgREST 直連不經 Nitro,evlog middleware 看不到。新增此類路徑 MUST 在 PR description 標註「此路徑在 evlog 觀測範圍外」。
NEVER
- NEVER 用
GRANT ... TO anon修 401——等於把資料公開給任何持有 publishable key 的人。401 的正解是修身分鏈,不是放寬權限。 - NEVER 留「session 層用 Cookie,但 DB policy 假設 Supabase JWT 存在」的混合狀態——瀏覽器不會因為帶著 Cookie Session 就自動變成
authenticatedrole。 - NEVER 為了取得
authenticatedrole 而自行簽 PostgREST JWT——同時維護 Cookie Session + JWT 兩套 session lifecycle(rotation、logout、角色同步)的複雜度通常比完整採用 Supabase Auth 更差。
Server 側:RLS policy 的前提條件
上面幾節管的是「瀏覽器直連 PostgREST」。本節管的是同一個身分鏈斷裂在 server 側的形態——它不會回 401,不會有任何錯誤,policy 靜靜地不放行或整個被繞過。
命題
RLS policy 裡的 auth.uid() 能取到值,前提是該 request 攜帶 Supabase Auth 簽發的 JWT。consumer 的 identity 來源若不是 Supabase Auth(Better Auth / nuxt-auth-utils / 自建 session),auth.uid() 靜默回 null——policy 語法正確、ENABLE ROW LEVEL SECURITY 也開著,但沒有任何 row 會通過。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday Changed · +3 lines 97df15057ce2
- 4d ago First seen · 91 lines · 0 tokens per session scan A e0c9bf05b0a6
auth-data-path-consistency is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,261 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
browser-extension
Browser extension patterns and development practices.
ci-patterns
CI/CD patterns and automation best practices.
test-setup-patterns
Test setup and configuration patterns.
process-management
Process management and zombie process prevention patterns.
coverage-thresholds
Coverage threshold configuration patterns.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.