feat(auth): authentication, subscriptions, and critical security hardening#20
Merged
Merged
Conversation
Deploying cherry-evals with
|
| Latest commit: |
501a242
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ebff30c7.cherry-evals.pages.dev |
| Branch Preview URL: | https://feat-auth-with-security-hard.cherry-evals.pages.dev |
This was referenced Mar 10, 2026
marinone94
force-pushed
the
feat/auth-with-security-hardening
branch
from
March 11, 2026 05:31
878a8ce to
f1ddd45
Compare
marinone94
added a commit
that referenced
this pull request
Mar 11, 2026
marinone94
added a commit
that referenced
this pull request
Mar 11, 2026
marinone94
force-pushed
the
feat/auth-with-security-hardening
branch
from
March 11, 2026 05:50
f1ddd45 to
4bbc832
Compare
…hardening - Supabase JWT auth with PyJWT (HS256, validates signature/expiry/audience) - API key auth (SHA-256 hashed, prefix for display) - Tier system: Free/Pro/Ultra with Polar.sh webhooks - 7-day Ultra trial for new signups - Rate limiting (in-memory burst + PostgreSQL daily quotas) - IDOR fix: ownership checks on all collection mutations - Config validator: auth auto-disables without JWT secret - UNIQUE constraint on users.email (migration 006) - GDPR endpoints: DELETE /account/me (erasure), GET /account/export (portability) - Legal pages: Privacy Policy, Terms of Service, Cookie Policy - Login consent notice linking to Terms/Privacy - Landing page links to app.cherryevals.com legal pages - Frontend: AuthContext, ProtectedRoute, Login/Account/Pricing pages - CORS locked to explicit methods and headers - Test fixtures with supabase_jwt_secret for auth-enabled tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…routes
- Add settings import and ownership check (IDOR fix) to export endpoint
- Wire require_paid + check_and_increment_llm_budget into /agents/discover,
/agents/ingest, /agents/{id}/export-custom, and /search/intelligent
- Wire check_semantic_search_quota into /search/semantic
- Add ownership check to /agents/{id}/export-custom
- Patch api.routes.agents.settings in all auth test fixtures
All 27 auth tests now pass. Free-tier users are properly blocked from
LLM-powered features (403), and collection export endpoints enforce
ownership to prevent IDOR.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Blocking fixes: - B1: Polar webhook signature — implement Svix format (v1,<base64>) with proper msg_id.timestamp.body signing - B2: API key count — use SELECT COUNT(*) instead of fetching all rows - B3: Race condition — atomic check-and-increment for daily quotas using SQL UPDATE...WHERE (eliminates concurrent burst abuse) - B4: IDOR check — move to shared check_collection_ownership() in deps.py, used by collections, export, and agents routes - B5: quota_reset_at — set explicitly in _provision_user to now+1day Non-blocking fixes: - NB1: Gate Langfuse export behind require_paid tier check - NB2: Wire check_search_rate_limit to keyword search endpoint - NB3: Add api.routes.agents.settings patch to authed_client fixtures (now removed since agents.py no longer imports settings) - NB4: LoginPage navigate() → <Navigate to="/" replace /> - NB5: Eager-load api_key.user with joinedload to prevent DetachedInstanceError - NB8: Only upgrade tier on active/trialing subscription status - NB10: Add min_length=1 to CreateApiKeyRequest.name - NB12: DRY authed_client fixtures with _make_authed_client factory - Sanitize filenames in Content-Disposition with regex - Sanitize error messages in search routes (no str(e) to client) - Add re module to exec sandbox safe_globals (from closed PR #21) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These files were being ignored by the top-level `lib/` gitignore pattern but are required for the frontend auth flow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marinone94
force-pushed
the
feat/auth-with-security-hardening
branch
from
March 11, 2026 05:55
8d7c1a1 to
501a242
Compare
marinone94
added a commit
that referenced
this pull request
Mar 30, 2026
These were implemented in PR #20 but not tracked in the audit doc. 34/46 findings now fixed. Only 1 before-launch item remains (DPAs — owner action). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
ck_live_formateffective_tier()helperusers.emailDELETE /account/me(Art. 17 erasure),GET /account/export(Art. 20 portability)GET, POST, PUT, DELETE, OPTIONS) and headersTest plan
supabase_jwt_secretfor auth-enabled teststest_auth.py— unauthenticated access (401), free tier restrictions (403), trial access, expired trialtest_rate_limits.py— rate limit enforcement tests🤖 Generated with Claude Code