Currently supported versions for security updates:
| Version | Supported |
|---|---|
| 1.x.x | β |
| < 1.0 | β |
We take the security of Replik seriously. If you discover a security vulnerability, please follow these steps:
Please do not open a public GitHub issue for security vulnerabilities.
Send a detailed report to: shoadachi1101@gmail.com
Include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
- Initial Response: Within 48 hours
- Status Update: Within 7 days
- Fix Timeline: Depends on severity (Critical: < 7 days, High: < 14 days, Medium: < 30 days)
We follow responsible disclosure practices:
- We'll work with you to understand and validate the issue
- We'll develop and test a fix
- We'll release a security update
- After the fix is deployed, we'll publicly acknowledge your contribution (unless you prefer to remain anonymous)
CRITICAL: Never commit .env files to git!
# Already in .gitignore:
.env
.env*.local
.env.productionThe SUPABASE_SERVICE_ROLE_KEY is extremely sensitive and must be protected:
β DO:
- Only use in API routes (server-side)
- Store in environment variables
- Rotate regularly (every 90 days)
- Use different keys for dev/staging/production
β DON'T:
- Never expose to frontend code
- Never log in console
- Never commit to git
- Never share publicly
All API keys should be treated as secrets:
| Variable | Sensitivity | Location | Notes |
|---|---|---|---|
SUPABASE_SERVICE_ROLE_KEY |
CRITICAL | Server-only | Bypasses RLS |
ANTHROPIC_API_KEY |
High | Server-only | Claude API access |
FISH_AUDIO_API_KEY |
High | Server-only | Voice synthesis |
MINECRAFT_API_KEY |
Medium | Server-only | External integrations |
NEXT_PUBLIC_SUPABASE_URL |
Low | Public | URL only, no secret |
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY |
Low | Public | Respects RLS |
Web Users:
- All authenticated via Supabase Auth
- Row Level Security (RLS) enforced on database
- Session tokens stored in HTTP-only cookies
Minecraft Mod:
- Requires
MINECRAFT_API_KEYin X-API-Key header - Or user must be authenticated via Supabase session
Public Endpoints:
/api/clones- Public by design (only returns public profiles)/api/minecraft/export/*- Public by design (only returns public clones)
Recommended Implementation:
// Using Upstash Redis Rate Limiting
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
const ratelimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(10, "10 s"), // 10 requests per 10 seconds
});Endpoints that need rate limiting:
/api/speak- Most expensive (AI + TTS costs)/api/clones- Can be scraped/api/minecraft/export/*- Public access/api/upload- File uploads/api/upload-photo- Image uploads
By default, Next.js API routes are accessible from any origin. For production:
- Add explicit CORS headers to public endpoints
- Whitelist your frontend domain
- Use proper preflight handling
Example:
export async function OPTIONS() {
return new Response(null, {
headers: {
'Access-Control-Allow-Origin': process.env.ALLOWED_ORIGIN || '*',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, X-API-Key',
},
});
}What to monitor:
- Failed authentication attempts
- Unusual API usage patterns
- API quota consumption (Anthropic, Fish Audio)
- Database query performance
- Error rates
What NOT to log:
- Full API keys or tokens
- User passwords
- Service role keys
- Personal identification information (unless necessary and encrypted)
Supabase Row Level Security (RLS):
All tables should have RLS policies. Current RLS setup:
-- Users can only see their own data
CREATE POLICY "Users can view own data" ON users
FOR SELECT USING (auth.uid() = id);
-- Users can update their own profile
CREATE POLICY "Users can update own data" ON users
FOR UPDATE USING (auth.uid() = id);Before deploying to production:
- All API keys in environment variables (not hardcoded)
-
.envfiles in.gitignore - Service role key is NOT in frontend code
- HTTPS enabled (force SSL)
- Rate limiting implemented
- Error messages don't leak sensitive info
- Database backups configured
- Monitoring and alerting set up
- CORS properly configured
- Security headers set (CSP, HSTS, etc.)
Rotate keys regularly:
| Key Type | Rotation Frequency |
|---|---|
| Service Role Key | Every 90 days |
| API Keys | Every 180 days |
| Database Passwords | Every 180 days |
| Minecraft API Key | Every 365 days |
Keep dependencies updated:
# Check for vulnerabilities
npm audit
# Fix automatically (if possible)
npm audit fix
# Review and update dependencies
npm outdatedEnable GitHub Dependabot alerts:
- Go to repo Settings
- Security & analysis
- Enable "Dependabot alerts"
-
No Rate Limiting - Endpoints can be abused
- Mitigation: Add Upstash or similar rate limiting
-
Public Minecraft Export - Anyone can export public clones
- Mitigation: By design for Minecraft integration. Users must opt-in via
isPublicflag
- Mitigation: By design for Minecraft integration. Users must opt-in via
-
Voice Model IDs Exposed - Fish Audio model IDs are visible
- Mitigation: IDs alone cannot be used without Fish Audio API key
-
No Request Signing - API requests aren't cryptographically signed
- Mitigation: Use HTTPS + authentication tokens
These limitations are acceptable because:
- The app is designed for public AI clones (opt-in)
- Users control what data they make public
- Authentication prevents unauthorized modifications
- Costs are limited by API provider rate limits
β Authentication
- Supabase Auth with JWT tokens
- Password + Google OAuth
- HTTP-only session cookies
β Authorization
- Row Level Security (RLS) on database
- User-specific data access
- Service role used only server-side
β Data Protection
- HTTPS enforced in production
- Secrets in environment variables
- No secrets in git history
β Input Validation
- Prisma ORM (prevents SQL injection)
- UUID validation on user IDs
- File type validation on uploads
β API Security
- Authentication required on sensitive endpoints
- API key support for external integrations
- Proper error handling (no info leakage)
Replik collects:
- User account info (email, name, username)
- Voice recordings (for cloning)
- Conversation history
- Personality context (stories, habits, reactions)
- Photos (optional, for visual representation)
- Voice recordings: Fish Audio (external service)
- Database: Supabase (PostgreSQL)
- Files: Supabase Storage
- Vector memories: ChromaDB (optional)
Users can:
- View all their data
- Delete their account (
/api/delete-account) - Export their clone data (JSON format)
- Control data visibility (
isPublicflag)
If deploying in EU:
- Add cookie consent banner
- Provide data export functionality β (already implemented)
- Implement data deletion β (already implemented)
- Add privacy policy
- Document data processing
For security concerns: shoadachi1101@gmail.com
For general issues: GitHub Issues
Last Updated: 2025-10-29