-
Notifications
You must be signed in to change notification settings - Fork 2
Protect admin pause/unpause and config mutation behind authentication #49
Copy link
Copy link
Open
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:securitysecuritysecuritypriority:highHigh priorityHigh prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:securitySecurity hardening / fixSecurity hardening / fix
Metadata
Metadata
Assignees
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:securitysecuritysecuritypriority:highHigh priorityHigh prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:securitySecurity hardening / fixSecurity hardening / fix
Type
Fields
Give feedbackNo fields configured for Feature.
Harden the admin and config endpoints with authentication
Description
POST /api/v1/admin/pause,POST /api/v1/admin/unpause, andPATCH /api/v1/configinsrc/index.tsare completely unauthenticated. Any caller can freeze the entire backend (the pause guard rejects all writes with 503) or rewrite the rate-limit and bulk-size config — a trivial denial-of-service. This issue gates these privileged operations behind an admin credential.Requirements and context
Agentpay-Org/Agentpay-backendonly.ADMIN_API_KEY(env-configured) on/api/v1/admin/pause,/api/v1/admin/unpause, andPATCH /api/v1/config; respond401 unauthorizedotherwise.GET /api/v1/admin/statusandGET /api/v1/configreadable (they expose no secrets)./api/v1/admin/unpausestill works once auth is added (operator must always be able to recover).Suggested execution
git checkout -b security/security-19-admin-authsrc/index.ts.src/admin-auth.test.ts— pause requires key, wrong key 401, status stays public.ADMIN_API_KEYinREADME.md.Test and commit
npm run build,npm test, andnpm run lint.npm testoutput and a threat-model note in the PR description.Example commit message
security: require admin key for pause/unpause and config mutationGuidelines
Community & contribution rewards