Skip to content

Reject non-global public base URL IPs#242

Merged
ramimbo merged 1 commit into
ramimbo:mainfrom
TUPM96:codex/bounty-228-reject-nonglobal-public-base-url
May 25, 2026
Merged

Reject non-global public base URL IPs#242
ramimbo merged 1 commit into
ramimbo:mainfrom
TUPM96:codex/bounty-228-reject-nonglobal-public-base-url

Conversation

@TUPM96
Copy link
Copy Markdown
Contributor

@TUPM96 TUPM96 commented May 25, 2026

/claim #228

Bounty: #228

Summary

  • Reject MERGEWORK_PUBLIC_BASE_URL IP literals that are not globally routable, including CGNAT and multicast ranges.
  • Preserve the existing loopback/private/link-local error paths and keep valid global public IP literals accepted.
  • Add regression coverage for IPv4 CGNAT, IPv4 multicast, and IPv6 multicast public base URL values.

Repro before fix

validate_deploy_settings() returned no errors for these deployment origins even though they are not suitable public base URLs:

https://100.64.0.1 -> []
https://224.0.0.1 -> []

Validation

  • uv run --python 3.12 --extra dev python -m pytest tests/test_deploy_readiness.py -q -> 25 passed
  • uv run --python 3.12 --extra dev python -m pytest -q -> 206 passed, 2 warnings
  • uv run --python 3.12 --extra dev ruff check app/config.py tests/test_deploy_readiness.py -> passed
  • uv run --python 3.12 --extra dev ruff format --check app/config.py tests/test_deploy_readiness.py -> passed after formatting
  • git diff --check -> clean

No secrets, wallet material, private vulnerability details, deployment credentials, PayPal details, or MRWK price claims are included.

Copilot AI review requested due to automatic review settings May 25, 2026 08:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_settings to 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.

Comment thread app/config.py
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 thread app/config.py
Comment on lines +240 to +241
elif is_non_global:
errors.append("MERGEWORK_PUBLIC_BASE_URL must use a globally routable host")
Copy link
Copy Markdown
Contributor

@tolga-tom-nook tolga-tom-nook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ramimbo ramimbo merged commit c59443c into ramimbo:main May 25, 2026
1 check passed
@ramimbo ramimbo added mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded labels May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants