supabase-security

Enforce Supabase API security with JWT handling, Zod validation, and rate limiting.

Updated Aug 29, 2023
One-click install
npx skills add https://github.com/SaschaLeh/dotfiles --skill supabase-security-saschaleh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-security
Source: https://github.com/SaschaLeh/dotfiles/tree/main/dot_claude/skills/supabase-security
Command: npx skills add https://github.com/SaschaLeh/dotfiles --skill supabase-security-saschaleh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Securing Supabase-powered applications by enforcing API and application-layer security best practices, including authentication, input validation, rate limiting, storage access controls, and CORS safeguards, while noting when to reference related skills like RLS policies.

Core Features & Use Cases

  • Authentication Security: JWT handling, key management, and session management to protect endpoints and user data.
  • Input Validation & Safe Data Handling: Zod-based validation for server actions and edge functions to prevent invalid data from entering the system.
  • Threat Mitigation & Compliance: SQL injection prevention via parameterized queries, rate limiting, storage bucket security, and CORS configuration for secure cross-origin requests.
  • Real-World Use Case: A Supabase-backed app safeguards user data by validating inputs, enforcing proper authentication, and securing file uploads to private buckets.

Quick Start

Implement JWT verification, enforce Zod validation, enable RLS, configure rate limiting, and use signed URLs for private storage to protect your app.

Frequently Asked Questions about supabase-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure JWT authentication in my Supabase application?

Securing JWT authentication in a Supabase application involves enforcing proper key management and session handling to protect endpoints. This prevents unauthorized access by validating tokens and managing environment-based secrets.

How do I prevent SQL injection when querying Supabase?

To prevent SQL injection in Supabase, use parameterized queries for all data access operations. This ensures user input is treated strictly as data rather than executable code, mitigating injection threats.

What is the best way to validate inputs in Supabase edge functions?

The best way to validate inputs in Supabase edge functions is using Zod schemas. This validation prevents invalid data from entering the system by enforcing strict data handling best practices at the application layer.

How do I secure file uploads to Supabase storage buckets?

To secure file uploads to Supabase storage buckets, enforce safe storage access controls and use signed URLs for private buckets. This protects user data by ensuring only authorized requests can access files.

Does this approach handle rate limiting and CORS configuration for Supabase?

Yes, this approach handles rate limiting and CORS configuration for Supabase. It safeguards cross-origin requests and mitigates threats by applying security best practices across REST and edge functions.

Do I need to enable Row Level Security alongside application-layer validation?

Yes, you need to enable Row Level Security alongside application-layer validation. While Zod schemas and JWT handling protect the API layer, RLS awareness ensures database-level access control policies are properly enforced.