Repository navigation
docs: correct the reason for refusing 0.0.0.0/8 in is_ip_blocked - #244
Merged
priyasingh2111 merged 1 commit intoNov 12, 2026
Conversation
8 tasks done
priyasingh2111
force-pushed
the
feature/correct-zero-network-comment
branch
from
November 11, 2026 20:20
a53327c to
feacc02
Compare
kevin-orellana
approved these changes
Nov 11, 2026
kevin-orellana
left a comment
There was a problem hiding this comment.
The comment now accurately describes the default network policy and addresses the feedback on #240. Verified that the diff remains comment-only after the rebase; no runtime behavior changes.
The comment said Linux routes 0.x.y.z to the local host. Since Linux 5.3, nonzero 0.0.0.0/8 addresses are ordinary unicast destinations (ip(7)), so that reason is wrong. The block stays: 0.0.0.0/8 is reserved and not globally reachable, and allowed_urls can still permit it. 0.0.0.0 itself is refused by is_unspecified(). Comment-only change; no behaviour changes.
priyasingh2111
force-pushed
the
feature/correct-zero-network-comment
branch
from
November 12, 2026 00:44
feacc02 to
15c91c1
Compare
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.
Human readable section
Problem: A code comment in
is_ip_blockedgave the wrong reason for refusing0.0.0.0/8. It said Linux routes0.x.y.zto the local host. Since Linux 5.3, nonzero0.0.0.0/8addresses are ordinary unicast destinations (seeip(7)), so that is not true on current Linux.Solution: The comment now gives the real reason:
0.0.0.0/8is reserved and not globally reachable, socurlrefuses it by default, andallowed_urlscan still permit it.Trade-off: None. This is a comment-only change. The block itself does not change, and
0.0.0.0itself is still refused byis_unspecified().Description
Follow-up to #240, from review feedback received after it merged.
Related Issues
#240
Documentation PR
None.
Type of Change
Other (please describe): comment correction only.
Testing
cargo test --lib url_safety: 9 passed.cargo fmt --all -- --checkis clean.curl http://0.1.2.3/Shellcurl: access denied: 0.1.2.3(status 1), refused before sendingcurl http://0.1.2.3/Shell::builder().allow_url("http://0.1.2.3")curl: (6) error sending request(status 6). The guard let it through and the request was sentcurl http://0.0.0.0/Shellcurl: access denied: 0.0.0.0, refused byis_unspecified()On Linux,
ip route get 0.1.2.3showsvia <default gateway> dev eth0: the kernel treats it as an ordinary unicast address and sends it to the default route, asip(7)describes for Linux 5.3+. The gateway refused the connection, which gives error(6). So the old "routes to the local host" comment was wrong, and the new one holds on both.cargo test --lib url_safetyalso passes on Linux (9 passed).Row 2 is why the comment says
allowed_urlscan still permit it:check_urlreturns early when a URL matches anallowed_urlsprefix, beforecheck_url_saferuns. "Reserved and not globally reachable" is from the IANA IPv4 special-purpose address registry (0.0.0.0/8, "This network", Globally Reachable: False).cargo test --workspace --all-targets,pytest tests/python,npm test)cargo fmtandcargo clippyChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.