fix: harden auth middleware security #1
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "schwifty/fix-auth-security"
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?
Changes
str_contains()with===in PUBLIC_ROUTES check to prevent substring bypass attacksstr_contains($path, "/api/admin/")was making ALL admin endpoints publicly accessible without authPAYFRIT_CRON_SECRETenv var to be set on the server, and callers must pass matchingX-Cron-Secretheader. Useshash_equals()for timing-safe comparison.Deployment Notes
⚠️ Before deploying, Raj needs to:
PAYFRIT_CRON_SECRETenv var on dev and biz servers (any strong random string)-H "X-Cron-Secret: <the-secret>"in their curl callsWithout this, cron endpoints will return 403 until configured.
Files Changed
api/helpers.php— route matching fix + newrequireCronSecret()functioncron/expireStaleChats.php— added cron secret checkcron/expireTabs.php— added cron secret checkapi/admin/scheduledTasks/runDue.php— added cron secret check