Open
Conversation
… HTTPS enforcement - Move SECRET_KEY and DEBUG to environment variables - Sanitize all error messages (str(e)) with sanitize_error_message() across 8 files - Move Google API key from URL query param to x-goog-api-key header - Add custom DRF exception handler for production 500s - Add security headers (X-Frame-Options, Content-Type-Nosniff, XSS-Filter) - Add HTTPS/HSTS enforcement when DEBUG=False - Fix IDOR in conversation_path (add user ownership check) - Move Firebase credentials path to env var - Reduce signed URL expiry from 900s to 300s - Set CORS_ALLOW_CREDENTIALS=False - Add rate limiting: 30/min AI generation, 10/min auth endpoints - Update .gitignore with security-sensitive file patterns - Remove unused scripts (fix_job_sync.py, trigger_sync.py)
0f18197 to
f7d8c78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a comprehensive security hardening layer for the Arena Backend, addressing multiple vulnerabilities related to credential exposure, IDOR, and resource abuse.
Key Changes
Secret Management & Infrastructure
SECRET_KEYandDEBUGto environment variables.FIREBASE_CREDENTIALS_PATHto an env var and removed absolute path logging.SECURE_SSL_REDIRECT,HSTS, and secure cookie flags (active only whenDEBUG=False).X-Frame-Options: DENY,Content-Type-Nosniff, andXSS-Filterheaders.API Security & IDOR Fixes
x-goog-api-keyheader.Rate Limiting & Resource Protection
directandcomparemodes.select_for_update()to ensure strict enforcement across concurrent requests.directorcomparemode sessions.Error Handling & Cleanup
sanitize_error_message(e)across 10+ files to prevent leaking internal traceback details or API keys in response logs.fix_job_sync.py,trigger_sync.py) and updated.gitignore.Verification Results
429 Too Many Requests.