Custom Webhook Integrations#434
Conversation
- Add jira_credentials table to store Jira API credentials - Create API routes for fetching Jira issues and managing credentials - Add ProjectMetrics component to dashboard showing issue status - Connect Jira using domain, email and API token - Display To Do / In Progress / Done counts with avg time to close - Show recent issues with status indicator Connected Jira issues now appear alongside PR analytics in the dashboard, giving teams better visibility into their overall project velocity.
- Encrypt API tokens using AES-256-GCM before storing in database - Add token_iv column for decryption (IV stored alongside ciphertext) - Add unique constraint on user_id for reliable upsert operations - Add domain validation to prevent arbitrary domain connections - Add project key validation (Jira format: uppercase letters + numbers) - Refactor duplicate user resolution into shared requireUser() helper - Export categorizeStatus and calculateMetrics for potential testing Fixes security concerns from PR Priyanshu-byte-coder#419 review: - Tokens no longer stored in plaintext - Domain validation prevents SSRF-like attacks - Project key validation prevents JQL injection
Next.js route files cannot export non-HTTP functions like categorizeStatus and calculateMetrics. Moved them to src/lib/jira-utils.ts to satisfy Next.js build requirements.
- Add webhook_configs and webhook_deliveries tables - Add RLS policies for webhook tables - Add API routes for CRUD operations on webhooks - Add test endpoint for sending test payloads - Add secret rotation endpoint - Add webhook dispatch library with HMAC signing - Integrate webhook dispatch for goal.created and streak.milestone events - Add WebhookManager component to dashboard settings - Add streak_milestones table for tracking milestones
|
Someone is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
- Add PATCH endpoint for goal progress updates with goal.completed event - Add inline progress editing in GoalTracker component - Add webhook dispatch endpoints for daily.summary, weekly.summary, metrics.updated - Add GET endpoint for users to trigger summary webhooks manually - Fix TypeScript errors
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Blocking: SSRF vulnerability in webhook dispatch.
validateUrl() only checks for http:/https: protocol — it does not block private IPs, loopback addresses, or internal hostnames. An attacker can register http://169.254.169.254/latest/meta-data/ or any internal endpoint, and the server will make an authenticated fetch to it. Both the registration endpoint and the test-fire endpoint are affected.
Fix: Before making any outbound fetch, resolve the URL's hostname and block RFC-1918 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), loopback (127.0.0.0/8, ::1), and link-local (169.254.0.0/16). Alternatively, use a DNS rebinding-safe HTTP client.
Additional required fixes:
- No per-user webhook limit —
dispatchToAllWebhooksfires all registered webhooks in parallel. Add a cap (e.g., 5 webhooks per user). secret_keystored in plaintext inwebhook_configs— store a keyed HMAC of the secret instead.- Jira credentials bundled in — the Jira domain validator (
/^[a-zA-Z0-9][-a-zA-Z0-9]*...) also accepts private IPs and should be restricted to*.atlassian.net. This feature belongs in a separate PR. - Missing
jira_credentialsmigration — the code references this table but no migration creates it. - Missing EOF newlines on all new files.
- Add SSRF protection: block private IPs, loopback, link-local addresses before any outbound webhook fetch (registration, test-fire, dispatch) - Add per-user webhook limit (5 webhooks max) in dispatch and creation - Encrypt secret_key in webhook_configs using AES-256-GCM instead of plaintext - Restrict Jira domain validator to *.atlassian.net only - Add missing jira_credentials migration - Add secret_iv column to webhook_configs for encrypted secrets - Add EOF newlines to all modified files
Security Fixes AppliedAddressed all mentor review feedback: 1. SSRF Vulnerability Fix
2. Per-User Webhook Limit
3. Secret Key Encryption
4. Jira Domain Restriction
5. Missing Migration
6. EOF Newlines
|
…ng EOF newlines - Add POST /api/webhooks/custom/[id]/deliveries/[deliveryId]/retry endpoint to re-deliver failed webhook deliveries - Add trailing newlines to dispatch routes, goal routes, and streak migration
Additional Fixes AppliedAfter deep analysis against issue #381 requirements, found and fixed remaining gaps: 7. Retry Failed Deliveries (Issue #381 Requirement #3)
8. Remaining EOF Newlines
Complete Issue #381 Coverage
All Mentor Blockers Resolved
|
Implements custom webhook integrations feature as requested in #381.
Features
API Endpoints
Database Changes
Supported Events