Skip to content

feat: webhook DLQ, health dependency graph, CSP headers, RBAC middleware (#601–#604)#683

Open
job-soft wants to merge 1 commit into
StellerCraft:mainfrom
job-soft:feat/issues-601-602-603-604
Open

feat: webhook DLQ, health dependency graph, CSP headers, RBAC middleware (#601–#604)#683
job-soft wants to merge 1 commit into
StellerCraft:mainfrom
job-soft:feat/issues-601-602-603-604

Conversation

@job-soft
Copy link
Copy Markdown
Contributor

@job-soft job-soft commented May 28, 2026

Summary

New files

File Purpose
src/lib/webhook-dlq/dead-letter-queue.ts DLQ store + reprocessor registry
src/app/api/admin/webhooks/dlq/route.ts Admin DLQ inspect/reprocess endpoint
src/lib/api/with-role.ts RBAC middleware
src/app/api/admin/analytics/route.ts Admin aggregate analytics (admin-only)
src/lib/api/security-headers.ts Security headers utility
docs/webhook-dead-letter-queue.md DLQ workflow documentation
docs/rbac-admin-middleware.md RBAC model documentation

Modified files

File Change
src/app/api/webhooks/stripe/route.ts 3-retry loop + DLQ capture
src/app/api/webhooks/github/route.ts 3-retry loop + DLQ capture + reprocessor
src/app/api/cron/health-check/route.ts Full dependency graph with response times
next.config.js Security headers on all /api/* routes
docs/security-scanning.md CSP policy documentation section

Closes #601
closes #602
closes #603
closes #604

🤖 Generated with Claude Code

…ph, CSP headers, RBAC

feat(webhooks): add dead letter queue for failed webhook events (StellerCraft#601)
- Capture failed events with full payload and failure reason after 3 attempts
- Add admin endpoint GET/POST /api/admin/webhooks/dlq for inspection and reprocessing
- Apply DLQ handling to both Stripe and GitHub webhook processors
- Prevent infinite reprocessing loops (succeeded entries cannot be re-enqueued)

feat(health): build health check endpoint dependency graph (StellerCraft#602)
- Report per-dependency health for database, Stellar, Vercel, Stripe
- Return structured graph with overall and per-dependency status
- Include per-dependency response time metrics; return 503 when database is down

feat(security): add content security policy headers to all API responses (StellerCraft#603)
- Add security headers middleware (CSP, HSTS, X-Frame-Options, Referrer-Policy)
- Configure CSP directives per environment (report-only in dev, enforced in prod)
- Apply headers consistently across all routes via next.config.js

feat(auth): add role-based access control middleware for admin routes (StellerCraft#604)
- Add withRole() middleware checking user role from Supabase metadata or ADMIN_USER_IDS env
- Apply to admin analytics and DLQ routes
- Return 403 for insufficient role, 401 for unauthenticated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

@job-soft Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant