fix(url): malformed webhook URL에서 empty host를 거부 - #1210
Draft
seonghobae wants to merge 4 commits into
Draft
Conversation
The `_is_safe_url` function failed to explicitly reject URLs with empty hostnames (e.g. `http://`), relying on exceptions from downstream `socket.getaddrinfo` which were silently caught. This updates the logic to fail fast if the hostname is empty. Also added tests to ensure protection against this bypass.
The `_is_safe_url` function failed to explicitly reject URLs with empty hostnames (e.g. `http://`), relying on exceptions from downstream `socket.getaddrinfo` which were silently caught. This updates the logic to fail fast if the hostname is empty. Also added tests to ensure protection against this bypass.
The `_is_safe_url` function failed to explicitly reject URLs with empty hostnames (e.g. `http://`), relying on exceptions from downstream `socket.getaddrinfo` which were silently caught. This updates the logic to fail fast if the hostname is empty. Also added tests to ensure protection against this bypass.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_is_safe_url()은urlparse()뒤 hostname이 비어 있어도socket.getaddrinfo("")의gaierror를 기존 dummy-domain compatibility 경로가 삼켜 최종True를 반환할 수 있습니다. 그 결과/api/v1/webhookingestion이http://,https://,http://user:pass@같은 구조적으로 잘못된 URL을 받아들일 수 있습니다.현재
_send_alert()는 이후urllib.request에서 이런 URL의 실제 전송에 실패하고False를 반환하므로, 이 PR은 해당 입력만으로 내부 주소에 도달하는 CRITICAL SSRF를 입증했다고 주장하지 않습니다. 문제는 URL-validation invariant가 fail-open이라는 점입니다.Minimal repair
parsed.hostname이 비어 있으면 DNS 조회 전에 즉시False.400 invalid webhook url을 반환하는 regression 유지..jules/sentinel.md보안 일반화는 승계하지 않음.Lineage
PR #1208의 유효 production/test delta만 ordinary commit lineage에서 승계했습니다. Exact successor head:
56515db327993fd0c7c074fe4bc1abe25fc9cc96. Protecteddevelop@e71d37e7c58118e6764c96ab7c4492fe33eed6f8대비 fresh compare는appguardrail_core/controlplane.py+2 lines,tests/test_controlplane.py+9 lines뿐입니다.Acceptance
Draft 상태에서 exact-head unit/integration tests, SAST/security checks와 independent review가 GREEN이어야 합니다. 별도 connect-time DNS rebinding/TOCTOU 문제는 이 empty-host repair와 합쳐서 해결했다고 주장하지 않습니다.