fix(webhooks): block SSRF to localhost, link-local, and private IP addresses
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- backend-api-design, security
Hướng nghiên cứu
Start with apps/api/src/webhooks/dto/create-webhook.dto.ts and apps/api/src/webhooks/webhooks.service.ts, focusing on createWebhook, testWebhook, and dispatch. Check how the project handles DNS lookup and IP range validation, then verify URL checks cover creation and immediately before requests. Done when unsafe protocols and resolved addresses are rejected and redirects cannot reach unvalidated destinations.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Description
In apps/api/src/webhooks/dto/create-webhook.dto.ts, CreateWebhookDto validates url using @IsUrl({ require_tld: false }) without restricting URL protocols or blocking internal/private network addresses.
This allows users to register webhook URLs pointing to localhost, 127.0.0.1, 169.254.169.254 (cloud metadata), or private IP ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, ::1, fc00::/7).
In apps/api/src/webhooks/webhooks.service.ts, both testWebhook and dispatch call fetch(endpoint.url) directly with no IP/protocol/DNS blocklist and follow redirects by default, enabling Server-Side Request Forgery (SSRF).
Expected Behavior
- Webhook URLs must only allow
http:andhttps:protocols. - Loopback, link-local (
169.254.0.0/16), private RFC1918/IPv6, multicast, and unspecified (0.0.0.0) addresses must be blocked both on creation and after DNS resolution right beforefetch(...). - Redirects on outbound webhook
fetchrequests should be disabled (redirect: 'error') or re-validated against the same blocklist.
Where to Look
apps/api/src/webhooks/dto/create-webhook.dto.tsapps/api/src/webhooks/webhooks.service.ts(createWebhook,testWebhook,dispatch)
Solution / Implementation Guide
- In
CreateWebhookDto, update@IsUrl(...)to enforceprotocols: ['http', 'https']andrequire_protocol: true. - Add an
assertSafeWebhookUrl(rawUrl: string)helper inwebhooks.service.ts(or a shared utility) that:- Parses the URL with
new URL(rawUrl)and checksprotocol === 'http:' || protocol === 'https:'. - Resolves the hostname via
dns.lookupand rejects private, loopback, link-local, multicast, and reserved IPv4/IPv6 ranges.
- Parses the URL with
- Call
assertSafeWebhookUrlincreateWebhook,testWebhook, anddispatchbeforefetch(...), and setredirect: 'error'infetchoptions.
- Ngôn ngữ chính
- TypeScript
- Star
- 2
- Fork
- 1
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sumamakhan761/tryinstance
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#65 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
sumamakhan761/tryinstance#64 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
sumamakhan761/tryinstance#63 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#62 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#60 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sumamakhan761/tryinstance
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100