Repository navigation
fix(backend): validate the endpoint host the client connects to - #13847
Merged
Merged
Conversation
validate_endpoint read the HTTP host from the text after the first `://`, but url also accepts `http:host/...` without `//`, so a later `://` in the path decided the check. The HTTP host is now required to be the address url parsed. The metadata host check ignores a trailing dot, and IPv4-mapped IPv6 addresses are checked as the IPv4 address they carry.
Contributor
Canonicalizing IPv4-mapped addresses let plain HTTP reach [::ffff:10.0.0.1], which v1 rejected. Reject mapped addresses instead, as nemoclaw-openshell's service_address_allowed does, and require the endpoint to start with its scheme and `://` so the authority read from the input is the one url parsed.
kaofelix
enabled auto-merge (squash)
October 27, 2026 14:09
cv
pushed a commit
that referenced
this pull request
Nov 3, 2026
…cal networks (#14081) ## Failure `validate_endpoint` and `service_address_allowed` accepted hosts that no endpoint or Service may name: - `fd00:ec2::254`, the AWS IPv6 metadata address. It passed as a private ULA address, so `http://[fd00:ec2::254]` was accepted as local HTTP. - The single label `metadata`, which GCE resolves to its metadata server. Only `metadata.google.internal` was rejected. - IPv4-compatible `::a.b.c.d` and NAT64 `64:ff9b::/96` hosts. They skipped the IPv4 checks, so `https://[::169.254.169.254]/v1` and `https://[64:ff9b::169.254.169.254]/v1` passed. #13847 closed this for IPv4-mapped `::ffff:a.b.c.d` only. Separately, gateway and service `networkCIDR` accepted octets with leading zeros. `ipnet` parses `172.030.1.0/24` as `172.30.1.0/24`, so validation passed. Then apply failed when Docker created the network: `IPv4 field has octet with leading zero`. ## Decision - **One shared check for addresses.** `forbidden_address` in `nemoclaw-backend` decides which addresses are never allowed. `validate_endpoint` and `service_address_allowed` both call it, so the two can't drift apart again. Before #13847 they disagreed on `::ffff:0.0.0.0`. - It forbids unspecified, multicast, link-local and the AWS IPv6 metadata address. - It forbids IPv6 that embeds IPv4 in all three forms (mapped, compatible other than `::` and `::1`, and NAT64). It doesn't convert them, because converting would accept plain HTTP to `[::ffff:10.0.0.1]`. - **Metadata host names.** The check rejects `metadata` as well as `metadata.google.internal`, in any case and with or without a trailing dot. - **Canonical networks.** `private_network` accepts a network only when it is written exactly as its canonical form. Gateway and service placement validation both use it. The configuration reference already says "Canonical private IPv4 /24", so the docs don't change. Each gap has an example test that fails on `v1` and passes here. ### How the gaps were found A proptest experiment found these gaps. It generated addresses from every class in every spelling `url` accepts, and compared each validator result with an independent check built only from the standard library's address predicates. At `v1`, each gap failed its property on 30 of 30 random seeds. Run against the commit before #13847, the same properties also found the gaps that PR fixed, and the example tests passed at that commit. Adopting proptest isn't part of this PR: - Mutation testing on these functions credited the properties with no mutant the example tests missed. - Most of the properties found nothing. The property tests stay parked on a local branch for now; mutation testing will be evaluated first. Not changed here, and each needs a decision first: - the IPv4 broadcast address is accepted over HTTPS; - local-use NAT64 `64:ff9b:1::/48` is accepted; - `100.100.100.200` (Alibaba Cloud metadata) is accepted. ## Validation - **Example tests:** the new cases in `endpoint_policy_rejects_credentials_metadata_and_remote_plaintext`, `cluster_profiles_accept_only_plain_service_endpoints_and_unicast_addresses`, `managed_gateway_network_is_written_without_leading_zeros` and `remote_service_is_independent_of_the_external_sandbox_gateway` fail on `v1` and pass with the fixes. - **Network rejection:** `docker network create --subnet 172.030.250.0/24` fails with `IPv4 field has octet with leading zero`. The canonical-form rule matches what Docker accepts. - **Each commit on its own:** the `nemoclaw-backend` and `nemoclaw-openshell` library tests, the `nemoclaw-sdk` `integration` target, and `cargo clippy -p nemoclaw-backend -p nemoclaw-openshell -p nemoclaw-sdk --all-targets -- -D warnings` pass. - **Combined with the property tests:** `cargo fmt --check` and `cargo clippy --workspace --all-targets -- -D warnings` pass on the tree that adds the property tests on top of these commits. - **Deferred to CI:** the full workspace test run and `cargo ci`. The change is limited to validation functions and their tests, so the bundle and lifecycle checks aren't affected.
cv
added a commit
that referenced
this pull request
Nov 11, 2026
…ms (#14413) The release notes now list every user-visible change on `v1` since the `v0.1.0-rc9` tag, including the breaking ones, and four example pages drop claims that later changes made false. ## Problem `docs/about/release-notes.md` listed three breaking changes and none of the features, fixes, and onboarding changes that reached `v1` after `v0.1.0-rc9`; it didn't name the configuration shapes the parser now rejects or the intent record version `v0.1.0-rc9` writes. Some example claims went stale: - `examples/spark/README.md` said the pinned OpenShell has the Podman TLS initialization blocker, ai-openshell/openshell#3427; its fix merged before OpenShell 0.1.0, and `v1` pins 0.1.7. - `examples/station/README.md` and `examples/gtc-dc/README.md` required exactly one visible GPU on the host; since #13929, `container.gpuDevices` lets a service on a host with more GPUs request one. - `examples/hcl/travel-team` said Fabric's Deep Agents adapter can't turn reasoning off, NVIDIA/NeMo-Fabric#433; NVIDIA/NeMo-Fabric#439 fixed that, and the pinned catalog's Deep Agents `reasoning_effort` accepts `none`. - The travel team cited #13313 for the booking key its service doesn't receive, but #13313 closed when `openshell_api` landed. ## Change - `docs/about/release-notes.md` gains "Changes Since v0.1.0-rc9", grouped by area, from the commits in `v0.1.0-rc9..origin/v1`; where a later commit changed an earlier one, the entry describes the current code, and changes added and removed after the tag aren't listed: - Agents and interfaces: #14037, #14038, #14269, #13981, #14024, #14186, #14052, #14385, #13971, #13858, #13947, #14039, #14042, #14044, #14343. - Inference: #13929, #14391, #14396, #14398, #14400, #13963, #13912, #13964, #14388, #14390, #14397. - Gateways and Kubernetes: #13909, #13970, #13922 (an existing namespace, refused at plan by #13756, is now bound; cluster-wide reads dropped), #14014, #14169, #13921. - Plan, apply, and diagnostics: #14224, #13756, #14141, #14133, #14135, #13775, #13744, #13701. - Onboarding: #13693, #13695, #13741, #13757, #13851, #13978, #14228, #14233, #14334, #14336. - Examples and builds: #14166, #14184, #14188, #14191, #14192, #14200, #13889, #14267, #14312, #14315, #14355, b30e9b4, #13781, #13813, #14246, and the pins in `versions.json` and `image/fabric/Dockerfile`. - Its breaking changes since the tag: - the intent record moving from 15, which `v0.1.0-rc9` writes, through 16 (#14266), 17 (#14343), 18 (#13929), 19 (#14391) and 20 (#14394); - name-keyed `sandboxes` and `inferenceProviders` (#13703, #13705); - a recipe `compatibility.gpu` outside every hardware profile (#13912); - model tuning the adapter doesn't accept (#14111), and Hermes's `max_tokens` losing its default (#14296); - `skills.paths` resolution (#14296); - endpoint and `networkCIDR` validation (#13847, #14081); - the HCL `gateway_values` attribute (#14014), and Kubernetes ownership receipts from before #13922 and #14014. The two earlier items stay, under their own heading. - `examples/spark/README.md` replaces the closed OpenShell#3427 blocker with the Podman and remote-model limits in `docs/resources/limits.md`. - `examples/station/README.md` and `examples/gtc-dc/README.md` require one GPU visible in the model container, and point to `container.gpuDevices` for a host with more. - `examples/hcl/travel-team/README.md` and `WALKTHROUGH.md` drop the NeMo-Fabric#433 limitation, and the travel team's booking-key statements link #14417 instead of #13313. Not listed, because both changes landed after the tag: Deep Agents Code (#14043, #14250), `compatibility.gpuCount` (#14391, #14394), and the "Creating infrastructure state" progress step (#14169, #14248). Checked and left unchanged: the root `README.md`, `crates/nemoclaw-onboarding/README.md`, `crates/nemoclaw-cli/assets/README.md`, `internal-docs/README.md`, the other example READMEs, and every example YAML header comment. The GPU autoscaling README and `load.sh` read the JSON fields `OperationResult` serializes, and ai-openshell/openshell#4287 is fixed only after the pinned 0.1.7. The two pre-tag release-note items still match the schema and SDK. `docs/README.md` is left to #14412, which retires the stale field reference snapshot it describes. Not verified: whether Hermes sends the booking key's placeholder to MCP servers; #14417 tracks the live check. ## Beyond CI Each relative link and anchor in the changed files resolves to an existing file and heading.
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.
Failure
validate_endpointtook the HTTP host from the text after the first://in the raw endpoint.urlalso parseshttp:host/...without//, so forhttp:8.8.8.8/://10.0.0.1/v1the check read10.0.0.1from the path while the parsed host was8.8.8.8, and the endpoint passed as private HTTP.Two host checks also compared a single spelling:
metadata.google.internal.with a trailing dot passed the metadata check, and IPv4-mapped IPv6 addresses such as[::ffff:169.254.169.254]skipped the unspecified, multicast, and link-local checks.Decision
://, so the authority read from the input is the oneurlparsed. The HTTP literal must also be the parsed address; the existing requirement for a literal spelling stays.service_address_allowedinnemoclaw-openshellalready does, rather than canonicalized: canonicalizing would newly accept plain HTTP to addresses such as[::ffff:10.0.0.1].Validation
v1, each was accepted, and each is rejected with the change. It also gainedhttp://[::ffff:10.0.0.1], which an intermediate version of this change accepted, plain HTTP to public IPv4 and IPv6 literals, which no test covered, and a private IPv6 HTTP endpoint that stays accepted.cargo testpasses fornemoclaw-backend,nemoclaw-sdk,nemoclaw-openshell, andnemoclaw-provider, the crates that callvalidate_endpoint.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkpass.cargo cidid not run locally; the change is confined to one function and its tests, and CI runs the bundle checks for crate changes.