Reject non-global public base URL IPs#242
Merged
ramimbo merged 1 commit intoMay 25, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR tightens deploy-time validation of MERGEWORK_PUBLIC_BASE_URL by rejecting IP literals that are not globally routable (e.g., CGNAT and multicast), and adds tests to ensure these cases are caught.
Changes:
- Add deploy readiness tests for non-global IP literal base URLs (CGNAT + multicast IPv4/IPv6).
- Extend
validate_deploy_settingsto flag non-global IP addresses with a new error message.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_deploy_readiness.py | Adds regression coverage for rejecting non-global IP-literal public_base_url values. |
| app/config.py | Adds a new validation branch to reject non-global IP literals (e.g., CGNAT, multicast). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| else: | ||
| is_loopback = ip_address.is_loopback | ||
| is_private_or_link_local = ip_address.is_private or ip_address.is_link_local | ||
| is_non_global = ip_address.is_multicast or not ip_address.is_global |
Comment on lines
+240
to
+241
| elif is_non_global: | ||
| errors.append("MERGEWORK_PUBLIC_BASE_URL must use a globally routable host") |
Contributor
tolga-tom-nook
left a comment
There was a problem hiding this comment.
No blockers from my review of the public base URL IP literal hardening.
Evidence checked:
- Inspected app/config.py and confirmed the new branch only applies after ipaddress.ip_address() successfully parses a literal, so DNS host validation behavior is unchanged.
- Confirmed loopback/private/link-local still keep their more specific existing error messages before the new non-global fallback.
- Confirmed the new regression covers CGNAT IPv4 plus IPv4/IPv6 multicast while the existing global-literal allow test still passes.
Local verification on PR head d6f74d6:
- python -m pytest tests/test_deploy_readiness.py -q -> 25 passed
- python -m ruff check app/config.py tests/test_deploy_readiness.py -> passed
- python -m mypy app -> passed
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.
/claim #228
Bounty: #228
Summary
MERGEWORK_PUBLIC_BASE_URLIP literals that are not globally routable, including CGNAT and multicast ranges.Repro before fix
validate_deploy_settings()returned no errors for these deployment origins even though they are not suitable public base URLs:Validation
uv run --python 3.12 --extra dev python -m pytest tests/test_deploy_readiness.py -q->25 passeduv run --python 3.12 --extra dev python -m pytest -q->206 passed, 2 warningsuv run --python 3.12 --extra dev ruff check app/config.py tests/test_deploy_readiness.py-> passeduv run --python 3.12 --extra dev ruff format --check app/config.py tests/test_deploy_readiness.py-> passed after formattinggit diff --check-> cleanNo secrets, wallet material, private vulnerability details, deployment credentials, PayPal details, or MRWK price claims are included.