Skip to content

Security: Studio-Poetics/enso

Security

SECURITY.md

Security Audit & Best Practices

✅ Security Measures Implemented

1. Authentication & Authorization

  • Supabase Auth: Production uses Supabase authentication with industry-standard security
  • Row Level Security (RLS): Database-level access control policies enforce permissions
  • Role-Based Access Control: Owner/Admin/Member/Viewer roles with different permissions
  • OAuth Support: Google and GitHub OAuth integration for secure third-party login
  • Password Requirements: Minimum 6 characters enforced
  • Session Management: Handled securely by Supabase with JWT tokens

2. Data Protection

  • RLS Policies: All database queries filtered by user permissions
  • No Direct Database Access: Client only has anon key, not service role key
  • Environment Variables: All secrets stored in .env files (gitignored)
  • No Hardcoded Secrets: All API keys loaded from environment variables
  • Project Visibility: Private/Team-wide controls with database enforcement

3. Frontend Security

  • No XSS Vulnerabilities: No use of innerHTML or dangerouslySetInnerHTML
  • No Code Injection: No eval() or new Function() usage
  • Input Validation: Email, password, and form validation on client and server
  • Error Messages: Generic errors that don't expose sensitive information
  • React: Automatic XSS protection through JSX escaping

4. API & Network Security

  • HTTPS Only: Vercel enforces HTTPS on all connections
  • CORS: Properly configured by Supabase backend
  • Rate Limiting: Handled by Supabase backend
  • API Key Protection: Gemini and Google Drive API keys in environment variables

5. File & Build Security

  • .gitignore: All .env files and secrets excluded from git
  • Build Process: Vite build strips development code
  • Dependencies: Regular updates via npm audit

⚠️ Known Development-Only Code

localStorage Implementation (storage.ts)

Status: DEVELOPMENT ONLY - NOT SECURE

This file provides a localStorage-based implementation for development:

  • Passwords stored as base64 (easily reversible) - NOT SECURE
  • No server-side validation
  • Single-device only
  • No encryption

Solution: Set VITE_USE_SUPABASE=true in production (already configured)


🔒 RLS Policies

Projects Table

View Policy: Users can view projects if:

  1. They are a member of the project's team, AND
  2. Either:
    • Project visibility = 'team' (all team members can see)
    • Project visibility = 'private' AND (user is owner OR user is in collaborators)

Update Policy: Users can update if:

  • User is the project owner, OR
  • User is in the project's collaborators array

Delete Policy: Users can delete if:

  • User is the project owner, OR
  • User is team admin/owner AND project visibility = 'team'

Insert Policy: Users can create projects if:

  • They are a member of the target team
  • They set themselves as the owner

🛡️ Security Checklist

Production Deployment

  • Environment variables set in Vercel
  • VITE_USE_SUPABASE=true
  • RLS enabled on all Supabase tables
  • Anon key used (not service role key)
  • HTTPS enforced
  • No console.log with sensitive data

Code Security

  • No hardcoded secrets
  • Input validation on forms
  • Generic error messages
  • No XSS vulnerabilities
  • No SQL injection (parameterized queries via Supabase)

Database Security

  • RLS policies on all tables
  • team_members table enforces team access
  • projects table enforces project-level permissions
  • profiles table protected by RLS
  • Database triggers ensure data integrity

🔐 Environment Variables

Required for Production

VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key  # PUBLIC - safe to expose
VITE_USE_SUPABASE=true

Optional Features

VITE_GEMINI_API_KEY=your-gemini-key  # For AI features
VITE_GOOGLE_API_KEY=your-google-key  # For Google Drive
VITE_GOOGLE_CLIENT_ID=your-client-id

🚨 Security Incident Response

If you discover a security vulnerability:

  1. Do NOT open a public GitHub issue
  2. Contact: [Your email/security contact]
  3. Include:
    • Description of the vulnerability
    • Steps to reproduce
    • Potential impact
    • Suggested fix (if any)

📋 Regular Security Tasks

Monthly

  • Run npm audit and fix vulnerabilities
  • Review Supabase dashboard for unusual activity
  • Check Vercel logs for suspicious requests

Quarterly

  • Review RLS policies for gaps
  • Update dependencies: npm update
  • Review user permissions and roles
  • Audit environment variables

Annually

  • Full security audit
  • Penetration testing (if budget allows)
  • Review and update this document

🔗 Resources


Last Updated: 2025-12-21 Status: ✅ Production Ready

There aren’t any published security advisories