security: add CSRF protection to API billing endpoints #13
Labels
No labels
P1
P2
P3
PHP
agent-ready
bug
clotho
discovery
docs
refactor
review
security
testing
athena
athena-gemini
audit
clotho
clotho-gemini
codex
darbs-claude
security
wiki
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: core/php-commerce#13
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue
Per TODO.md (P1 line 35), routes in
routes/api.phpuseauthmiddleware but notverifiedor CSRF tokens for state-changing operations.Current Behavior
routes/api.phpdefines billing API endpoints:Risk
CSRF attacks: Without CSRF protection, an attacker could:
Required Fix
Option 1: Add CSRF middleware (for web-based API)
Option 2: Use Sanctum token-based auth (for SPA/mobile)
If these are intended for SPA/mobile apps:
Option 3: Separate web and API routes
api.phpwith token authweb.phpwith CSRF protectionFiles to Review
routes/api.php- Add CSRF middleware or document exemptionMiddleware/CommerceApiAuth.php- Review authentication strategyPriority
P1 - Critical: CSRF protection is essential for production security.
Created by discovery scan (issue #2) - References TODO.md P1