T09 · Insecure Skill Coding Practices
- Location
scripts/setup_webhook.py:139- Finding
Unauthenticated webhook test server exposes complete email payloads
- Content
View full analysis
AgentMail Webhook Test Server✅ Server is running
Webhook endpoint:
POST /webhookCheck console output for incoming webhooks.
""" @app.route('/webhook', methods=['POST']) def webhook(): payload = request.json print("\n🪝 Webhook received:") print(f" Event: {payload.get('event_type')}") print(f" ID: {payload.get('event_id')}") if payload.get('event_type') == 'message.received': message = payload.get('message', {}) print(f" From: {message.get('from', [{}])[0].get('email')}") print(f" Subject: {message.get('subject')}") print(f" Preview: {message.get('preview', '')[:50]}...") print(f" Full payload: {json.dumps(payload, indent=2)}") print() return Response(status=200) print("🚀 Starting webhook test server on http://localhost:3000") print("📡 Webhook endpoint: http://localhost:3000/webhook") print("\n💡 For external access, use ngrok:") print(" ngrok http 3000") try: app.run(host='0.0.0.0', port=3000, debug=False) ``` ### Technical Analysis The test receiver accepts POST requests without verifying an AgentMail webhook signature, shared secret, or other authentication credential. It binds to `0.0.0.0`, making the endpoint reachable through every available network interface, and the script explicitly suggests exposing it through ngrok. The handler also serializes the complete webhook payload to standard output. AgentMail message events can include sender and recipient addresses, subject lines, message bodies, thread metadata, attachment metadata, and other potentially sensitive information. In environments where standar ...[truncated 1953 chars]- Remediation
View remediation
