T09 · Insecure Skill Coding Practices
- Location
src/utils/webhook-server.js:24- Finding
Unauthenticated Network-Exposed Webhook Permits Forged Email and Agent Events
- Content
View full analysis
{ receiveEmail(payload); }); } } } ``` ```javascript this.server.listen(this.port, this.host, () => { console.log(`[webhook] Server listening on ${this.host}:${this.port}`); console.log(`[webhook] ${this.handlers.size} handlers registered`); resolve(this); }); ``` ```javascript // Check registered handlers const handler = this.handlers.get(path); if (handler) { try { handler(payload, req.headers, req); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ received: true, path })); return; } catch (e) { console.log(`[webhook] Handler error for ${path}: ${e.message}`); res.writeHead(500, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ error: e.message })); return; } } // Check observe webhooks (registered via observe(..., { method: 'webhook' })) if (globalThis.__reachWebhooks) { const observeHandler = globalThis.__reachWebhooks.get(path); if (observeHandler && observeHandler.callback) { try { observeHandler.callback({ type: 'webhook', target: observeHandler.target, path, payload, headers: req.headers, timestamp: new Date().toISOString(), }); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ received: true, path, observer: observeHandler.id })) ...[truncated 2323 chars]- Remediation
View remediation
