Wire NetworkConfig through Bash + curl + interpreter (closes #5)#7
Open
ajram23 wants to merge 4 commits into
Open
Wire NetworkConfig through Bash + curl + interpreter (closes #5)#7ajram23 wants to merge 4 commits into
ajram23 wants to merge 4 commits into
Conversation
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.
What this does
Upstream defines
NetworkConfigandCommandContext.fetchbut they never reachBash,Interpreter, or thecurlcommand, so passingnetwork=NetworkConfig(...)is a no-op (see #5 — "command not found\nIs shown even when a network config is provided"). This PR wires the plumbing through so the documented surface actually executes network calls.Components
Touches
src/just_bash/__init__.py,bash.py,commands/curl/curl.py,interpreter/interpreter.py,types.py, and addssrc/just_bash/network/__init__.py+tests/test_network.py.NetworkConfigcurlcommand registered only whennetwork/fetchis configured (no-op fallback otherwise — preserves existing behavior)startsWith)max_redirects,timeout_ms,max_response_sizeenforceddeny_private_rangeswith lexical IPv4/IPv6 checks + DNS-resolution recheck, DNS-pinnedaiohttp.TCPConnectorto defeat rebinding between preflight and connectionRequestTransform) applied at the fetch boundary so credentials never enter the sandboxcurl -owritesTS-parity hardening
Ported from
vercel-labs/just-bashsrc/network/allow-list.ts:validateAllowListfrommake_default_fetchunlessdangerously_allow_full_internet_access=True— rejects malformed entries, missing scheme/host, non-http(s) schemes, query strings and fragments, and ambiguous path separators (\,%2f,%5c)URL.origin: lowercase scheme/host, strip default ports (:80,:443), exact non-default ports100.64.0.0/10(whichipaddress.IPv4Address.is_privatemisses in 3.11), benchmarking198.18.0.0/15, IETF/TEST-NET, and reserved240/42130706433and0x7f.0.0.1style numeric forms (socket.getaddrinfocatches them at resolve time but the lexical pass needs parity with the TS sibling)::,::1,fe80::/10,fc00::/7,::ffff:IPv4-mapped,2001:db8::/32, NAT6464:ff9b::/96, NAT64-local64:ff9b:1::/48, 6to42002::/16with embedded-v4 recheckContent-Lengthparsing (malformed → ignored, rely on streamed body-size enforcement instead of bubblingValueError)Tests
tests/test_network.pycovers allow-list validation + matching, allowed-methods, redirects with per-hop checks, timeout, response size, private ranges, content-length parsing, header transforms, and byte-preserving response body.Why upstream this now
This work has been carrying as a fork (
ajram23/just-bash-pytagv0.1.16.post1) since May 2026 to unblock real agent network operations (thecurlcommand in a sandboxed agent fetch loop is the load-bearing use case). The fork'sORBIT_FORK.mdexplicitly tracks the retirement criterion: "Delete the fork and switch back to upstream PyPI just-bash once dbreunig/just-bash-py releases a version that wires NetworkConfig through Bash and ships the TS-parity allow-list / private-range checks." This PR is that release candidate.Closes #5.