[Security] Authenticate webhook management endpoints and stop trusting client-supplied userAddress
Overview & Background
All webhook management routes (createWebhook, listWebhooks, deleteWebhook, updateWebhook, regenerateSecret, listDeliveries, testWebhook) are mounted with no auth middleware. Ownership is "verified" purely from request input: the controller reads userAddress from req.body / query and the service scopes queries by it. Any unauthenticated caller can create, list, update, or delete any wallet's webhook subscriptions by quoting the victim's address, and POST /v1/webhooks/:id/secret returns a freshly generated signing secret for someone else's subscription — enabling forged, validly-signed webhook payloads to the victim's endpoint.
Technical Specification & Architecture
- Add
requireAuthto every webhook route inbackend/src/routes/v1/webhook.routes.ts:66-196(the file currently imports no auth middleware, andbackend/src/routes/v1/index.ts:19adds no global auth). - Derive ownership server-side: compare
req.user.publicKeyagainst the subscription's owner. Never acceptuserAddressfrom body/query as an authorization input (backend/src/controllers/webhook.controller.ts:15,:50;backend/src/services/webhook.service.ts:173-177). - Audit
regenerateWebhookSecretso the newsecretKeyis only returned to the authenticated owner.
Target Files
backend/src/routes/v1/webhook.routes.tsbackend/src/controllers/webhook.controller.tsbackend/src/services/webhook.service.ts
Acceptance Criteria
- [ ] Every webhook route requires authentication.
- [ ] Operations are scoped to
req.user.publicKey; supplying another address has no effect. - [ ] Unauthenticated tests for all seven endpoints return 401.
- [ ] Cross-tenant access tests (acting on another user's subscription) return 403/404.
@OlamideAdesina has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
Hi maintainer, I can get this issue fixed quickly. Please assign it to me
ℹ️ Repo Maintainers: To accept this application, review their application or assign @OlamideAdesina to this issue.
Congratulations, @OlamideAdesina! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.
🧑💻 @OlamideAdesina: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
This issue has been completed by @OlamideAdesina as part of the Stellar Wave Program's 11th Wave 🥳
😎 @OlamideAdesina: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.