Repository navigation
Description
Problem
Lines cited at dcafadf. Paths are under src/devops_cli/ unless they start with tests/. Every httpx2, urllib.parse and kubernetes-client behaviour below was confirmed by offline probes (no network, no DNS, no cluster) against httpx2 2.13.0 and kubernetes 36.0.3, the exact pins at pyproject.toml:19 and :23. The rest comes from reading the code at that commit.
Service, node and API-proxy URLs are assembled with f-strings and scheme://netloc splicing. httpx2 is already the transport for all of them, and its httpx2.URL builder handles every case below.
Confirmed defects:
- IPv6 addresses produce URLs nothing can parse.
f"http://{host}:{port}"with an IPv6 node or LoadBalancer address giveshttp://2001:db8::1:30080.urllib.parseraisesValueError: Port could not be cast to integer valueon it, andhttpx2.URLraisesInvalidURL: Invalid port.httpx2.URL(scheme="http", host="2001:db8::1", port=30080)giveshttp://[2001:db8::1]:30080. The sites:commands/k8s/networking.py:122(node address fromkubectl get nodes),:165(LoadBalancer ingress) and:411-412(OTel endpoint derived from the Jaeger host);k8s/service.py:327and:334(the same two lookups through the Kubernetes client);telemetry/collector.py:25, whose host comes fromcluster_host(k8s/node_port.py:66-74), which strips the brackets throughurlparse().hostname;sandbox/probe.py:515and:527(HTTP and OpenAPI probe URLs).
configure-urlsfails on an IPv6 cluster. Both stacks pass the detected URLs to_resolve_accessible_url: the infra stack (_configure_infra_stack_urls,networking.py:366-390) and the LLM stack (_configure_llm_stack_urls,:447-470). When nothing answers on the preferred localhost ports,_resolve_accessible_url("http://2001:db8::1:30080")raisesValueErroratnetworking.py:360(parsed.port). Nothing on the path fromconfigure_urls(:861) through_dispatch_nodeport_urls(:820-830) catches it.- Dot segments and unchecked fields leave the Service proxy and carry the kubeconfig credential.
ServiceRef.proxy_path(k8s/service_proxy.py:73-87) andresolve_proxy_target(:246-258) append the caller's path to/api/v1/namespaces/{namespace}/services/{target}/proxywith no check. Namespace, service and port go into that template unchecked as well.- httpx2 removes dot segments (RFC 3986 section 5.2.4) when it parses the URL it sends. So
devops k8s service-url prometheus -n monitoring --port 9090 --path ../../../secrets/foo --fetchsends/api/v1/namespaces/monitoring/secrets/foo, which is the Secret read endpoint, not the Service.get_json(k8s/service_http.py:47-58) sends it with the kubeconfig's credentials (its bearer token or client certificate,service_proxy.py:202-234) and prints the reply (commands/k8s/networking.py:1226-1235). --portis free text.--port '9090/../../secrets/foo?'sends/api/v1/namespaces/monitoring/secrets/foowith/proxyas the query, and--port '9090?'moves/proxyinto the query (both measured).- Namespace and service:
ServiceRef(namespace="..", service="..", port="80")resolves to/api/v1/services/..:80/proxy. - Configured values:
parse_service_url(service_proxy.py:102-138) keeps..segments, sok8s://monitoring/prometheus:9090/../../../secrets/fooparses with path../../../secrets/foo. Today's callers of configured values replace that path. The dashboard passesapi/v1/label/__name__/values(ui/data_providers.py:455-460), and Qdrant goes throughresolve_proxy_connection, which passespath=""(service_proxy.py:295). So a configured path is sent only byget_json(url)with no path, and today only the CLI's--fetchcalls that (networking.py:1227). A configured namespace is used by every caller. - A
k8s://address names a Service. It must not reach any other API path.
- An
https://probe target is probed over http._parse_target_endpoint(sandbox/probe.py:485-495) drops the scheme, and endpoints travel as(host, port)tuples (:399,:403-404,:455-466). Sohttps://example.com:8443is probed athttp://example.com:8443/healthz. fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 makes that function return anhttpx2.Origin, scheme included, and carries origins to the loop at:455, which still passes only host and port to_dispatch_probes_for_port. This item passes the origin on and builds the probe URLs from it, because it rewrites the lines that build them. - Other string-built URLs of the same kind:
networking.py:679buildsf"https://{chosen}"from an Ingress host.networking.py:570re-renders thek8s://form thatServiceRef.describe()(service_proxy.py:89-94) already renders.networking.py:1029printshttp://{address}:{lport}, which readshttp://::1:8080for--address ::1. kubectl's--addresstakes a comma-separated list, so--address localhost,::1printshttp://localhost,::1:8080. The print runs aftersubprocess.Popen(:1011) and beforedaemon_mgr.save_forwards(:1030). If it raised, the detached port-forward would keep running with nothing recording it. A literalhttpx2.URL(scheme="http", host="localhost,::1", port=8080)raisesInvalidURL(measured).service_proxy.py:291-302andservice_http.py:28-35splicef"{parsed.scheme}://{parsed.netloc}". This is cleanup, not a leak: kubeconfig server URLs carry no userinfo, and these strings only become in-memory pool keys (http/pool.py:61-76) that are never logged.service_http.py:62joins a direct URL and a path withrstrip("/")andlstrip("/").
Replacement: build with httpx2.URL(scheme=..., host=..., port=...). It brackets IPv6, including ::ffff:192.0.2.1 and fe80::1%eth0, and both urllib.parse.urlsplit and httpx2.URL parse the result back to the same host and port. Each rule below comes from a measured httpx2 behaviour. Skipping one causes a regression.
- Default ports. httpx2 drops them:
port=80giveshttp://192.0.2.10, and.portisNone. The loopback fallback atnetworking.py:358-361testsif parsed.port:, so a port-80 LoadBalancer would lose the fallback it gets today (http://localhost:80). Read the port withhttpx2.URL(url).origin.port, which fills in the scheme's default. - Empty hosts.
host=""buildshttp://:30080without an error. Keep the existingif node_ip,if lb_hostandaddr.addressguards. - OTel endpoint. Build a fresh
httpx2.URL(scheme="http", host=httpx2.URL(jaeger_url).host, port=CONST_OTEL_OTLP_HTTP_PORT)(config/constants.py:989). Do not usecopy_with, which keeps the query and userinfo:copy_with(port=4318, path="/")onhttp://example.com:16686/search?x=1giveshttp://example.com:4318/?x=1. This also removes the literal4318atnetworking.py:412. - Appending a path. One function,
append_path(base, reference), does every append in this item:proxy_path(on the scheme-less template path),resolve_proxy_target,describe(),get_json's direct branch (service_http.py:62) and the probe's HTTP paths. It returns anhttpx2.URLand works like this:- An empty reference returns the base unchanged, so the Service root stays
.../proxywith no trailing/(pinned attests/test_k8s_service_proxy.py:86-90). - The base's path is made to end in
/throughcopy_with(raw_path=...). Do not usecopy_with(path=...), which takes the decoded path: onhttps://example.com/a%2Fbit giveshttps://example.com/a/b/. - The reference loses its leading
/and gets./in front, the form RFC 3986 section 4.2 prescribes for a relative path, and is then passed tobase.join(...). - Without that step,
joinmisreads three kinds of reference (all measured)./api/v1/xcounts as an absolute path, so onhttps://example.com/k8s/clusters/c-1/it giveshttps://example.com/api/v1/x.foo:barcounts as a URI with schemefoo.//other.example.com/xcounts as another host. - With it,
foo:bargives/foo:barand//other.example.com/xgives/other.example.com/xon the same host, as today's f-strings do. On.../k8s/clusters/c-1/,./api/v1/namespaces/ns/services/svc:80/proxy/a%2Fb?x=1keeps the prefix, the%2Fand the query. - Why a function and not a library call:
httpx2.URL.joinandurllib.parse.urljoinresolve a reference (RFC 3986 section 5.2), and neither has an "append this path" call. httpx2's own append, thebase_urlmerge ofhttpx2.Client(trailing/on the base, leading/dropped from the reference), is private to the client. yarl's/operator appends, but yarl is only a transitive dependency (1.24.5, through aiohttp), and fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 rules out a second URL parser. The function is built only from httpx2 calls; it parses nothing itself. - The kubernetes client keeps the server's path the same way (
url = self.configuration.host + resource_pathin itsApiClient).
- An empty reference returns the base unchanged, so the Service root stays
- Encoding. Do not quote the reference.
urllib.parse.quote(seg, safe="")turnsa%2Fbintoa%252Fbandhttps:prom:9090intohttps%3Aprom%3A9090. httpx2 leavesa%2Fbas is. - Dot segments. A path is refused when httpx2 would rewrite it. The test is httpx2's own normalisation, the code that causes the escape, not a segment parser:
- httpx2 keeps dot segments in a scheme-less
httpx2.URL(path=...)and removes them (RFC 3986 section 5.2.4) oncecopy_with(scheme=..., host=...)makes the URL absolute. A path whoseraw_pathdiffers between the two is refused. Measured:/a/../bbecomes/b. - The test reads the path part of the reference, without its leading
/and without its query. It runs on the percent-decoded path re-encoded withurllib.parse.quote(urllib.parse.unquote(path), safe="/"), so%2e%2ereads as... httpx2 sends%2e%2eunchanged, and how the API server treats it was not measured. The re-encoded copy is only tested, never sent. - Measured with that test:
../../../secrets/foo,/../grafana:80/api/health,a/../b,.,./x,%2e%2e/x,.%2e/xand%2E/xare refused;a%2Fb,foo:bar,.hidden,a..b,...,x//y,a%3Fb,üandapi/v1/label/__name__/valuespass. - It runs wherever a path enters the proxy: when a
ServiceRefis built (below), on aproxy_pathoverride, and onget_json'spath(direct andk8s://alike). It is refused withServiceAddressError. - The probe's
--pathis not tested: it carries no credential, and httpx2 already normalises it today.
- httpx2 keeps dot segments in a scheme-less
ServiceRefchecks itself when it is built. Its__post_init__raisesServiceAddressErrorif a field is bad:namespace,serviceorportfailsvalidate_k8s_identifier(..., namespace=True)(core/validation.py:450). That is the RFC 1123 label rule (CONST_K8S_LABEL_RE,config/constants.py:564). It accepts a port number and a port name such ashttp-query, and refuses?,#,/,.and:. Re-raise itsValidationErrorasServiceAddressError.pathfails the dot-segment test.- This must happen at construction, not only on append, because
--fetchsendsref.describe()(networking.py:1227), and httpx2's builder removes dot segments. Built with httpx2,describe()of path/prometheus:9090/../grafana:80/api/healthrendersk8s://monitoring/grafana:80/api/health(measured), so--path ../grafana:80/api/health --fetchwould silently fetch from Grafana. Once the constructor refuses such a ref, nodescribe()ever renders a rewritten address.
- Where
ServiceAddressErrormust be caught. It is caught today atnetworking.py:1206and:1228and atservice_http.py:76.service_urlbuilds itsServiceRefatnetworking.py:1193, outside both try blocks. Wrap that build too, withexit_on_error(ServiceAddressError)fromcore/cli.py:187-200, which prints the message and exits with the error's code.- That catch is needed because the command is registered bare (
app.command("service-url")(service_url),commands/k8s/__init__.py:109).main.pyruns commands withstandalone_mode=False(:144-148) and catches onlyclick.ClickException(:169) andSystemExit(:185). An uncaughtServiceAddressErrortherefore ends in a traceback. - The other constructors need no change.
parse_service_url(service_proxy.py:131) already raisesServiceAddressErrorto its callers.discover_service(:342) takes its names from the API server, and they already meet the rule.
describe(). Appendpathwithappend_pathto the scheme-lesshttpx2.URL(path="/<service>:<port>"), then callcopy_with(scheme=..., host=namespace). Passquery=only whenqueryis non-empty, becausequery=b""emits a trailing?. Measured: this rendersk8s+https://argocd/argocd-server:443/api/v1/session?a=1.- Do not join onto a
k8s://base. For a scheme it does not know, httpx2'sjoinreturns the reference unchanged: onk8s+https://argocd/argocd-server:443/,join("./api/v1/session")gives./api/v1/session(measured).append_paththerefore takes an http(s) base or a scheme-less one. networking.py:570builds aServiceRefand callsdescribe()instead of keeping its own f-string.- Every entry in
_PROXY_TARGETS_INFRAand_PROXY_TARGETS_LLM(:497-507) carries a numeric port hint. The<port>fallback at:569is therefore never used, and the port check would refuse it, so it goes.
- Do not join onto a
- Pool keys and the Qdrant split.
_transport_keybuilds its key fromhttpx2.URL(url).origin(scheme, host, port), which drops userinfo, lowercases the host and fills in the default port.resolve_proxy_connectionbuildsbase_urlfresh from that origin's scheme, host and port. It takesprefixfrom the raw path,urllib.parse.urlsplit(str(url)).path, as today'surlparsedoes, and not from httpx2's.path, which percent-decodes:/a%2Fb%20creads as/a/b c.- The fresh base carries no path, which qdrant-client 1.19.1 requires when a prefix is given (
qdrant_remote.py:109-112). A default port dropped from it is fine: with no port, the client addresses the host alone (:209).
- Probe scheme. fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 returns every probe endpoint as an
httpx2.Origin: a target with its own scheme, a barehost:portwith schemehttp, and a sandbox instance's port bindings (:399) with schemehttp._dispatch_probes_for_porttakes that origin in place ofhostandport, and the loop at:455passes it.- The HTTP and OpenAPI probes build their base with
httpx2.URL(scheme=..., host=origin.host, port=origin.port). The scheme ishttpswhen the origin's ishttps, andhttpotherwise, so agrpc://target keeps its HTTP probes over http as today. - The TCP and gRPC probes take
origin.hostandorigin.port.
- Port-forward message. Build
httpx2.URL(scheme="http", host=address, port=lport)from--addressas given.- A value httpx2 refuses with
httpx2.InvalidURLis printed as written, next to the local port, so the message never raises. That covers kubectl's comma-separated list:localhost,::1raisesInvalidURL(measured). No list parsing is added. - The URL text is built before
Popen, so nothing between starting the process andsave_forwardscan raise. The pid is added after.
- A value httpx2 refuses with
Out of scope:
commands/ai_runs.py:159(avalkey://URL built fromcluster_host) andnetworking.py:419-444and:484-491(the Valkey host checks and thehost:portwritten intovalkey.host) have the same IPv6 defect. They belong to fix(valkey): one validated URL names every Valkey endpoint, valkey-py dials an address that one check vetted, and the unused cache layer goes #1113, which makes the Valkey endpoint one URL.telemetry/waterfall.py:187-191brackets IPv6 by hand and sendsHost: netloc. It belongs to fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898.- How the probe target is read (
probe.py:485-495, which fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 makes return anhttpx2.Origin), its test rows (tests/test_sandbox_probe.py:493-507), and the port table atnetworking.py:223belong to fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112. This item uses the origin where the probe URLs are built. probe_openapi(probe.py:321-322) and_extract_safe_openapi_endpoints(:357) keep their own joins. They append to the base they are given, which is now well formed.security/vault_broker.py:105,:146and:167keep their f-strings. No defect was shown there.- Builds with a literal loopback host stay, because the URL is always well formed: for example
networking.py:238,:246,:249and:922-927. So does the dry-run placeholder atnetworking.py:590(http://<node>:<port>), which is display text and is never sent.
Acceptance criteria
- An offline table test covers the builders, one row per site:
- a node address
2001:db8::1with NodePort 30080 giveshttp://[2001:db8::1]:30080(networking.py:122,k8s/service.py:334); - a LoadBalancer ingress IP
2001:db8::1on port 9090 giveshttp://[2001:db8::1]:9090(networking.py:165,k8s/service.py:327); - an API server
https://[2001:db8::1]:6443gives a collector endpointhttp://[2001:db8::1]:<nodePort>; - a Jaeger URL
http://u:pw@[2001:db8::2]:16686/?x=1givesotel.endpointhttp://[2001:db8::2]:4318, with no userinfo, path or query; ::ffff:192.0.2.1andfe80::1%eth0come out bracketed and parse back withurlsplitandhttpx2.URLto the same host and port;- a probe of
2001:db8::1on port 8080 with pathhealthbuildshttp://[2001:db8::1]:8080/health, and its OpenAPI base ishttp://[2001:db8::1]:8080; - the proxy-mode dry-run preview equals
ServiceRef(...).describe()for every key.
- a node address
- Port-forward message, with
subprocess.Popenand the daemon manager mocked:--address ::1printshttp://[::1]:<port>;--address 0.0.0.0printshttp://0.0.0.0:<port>;--address localhost,::1printslocalhost,::1as written with the port, raises nothing, andsave_forwardsrecords every forward started.
configure-urlson an IPv6 cluster. The Kubernetes lookups are mocked to return a NodePort Service and a node whose InternalIP is2001:db8::1. Today both rows below raiseValueErroratnetworking.py:360.- With
socket.create_connectionpatched so that connections to2001:db8::1succeed and connections tolocalhostand127.0.0.1fail,_configure_infra_stack_urlsand_configure_llm_stack_urlsraise nothing. They write bracketed URLs:http://[2001:db8::1]:<nodePort>for each detected service, andotel.endpointhttp://[2001:db8::1]:4318.valkey.hostis fix(valkey): one validated URL names every Valkey endpoint, valkey-py dials an address that one check vetted, and the unused cache layer goes #1113's and is not asserted. - With every connection refused, both raise nothing and write the loopback fallback
http://localhost:<nodePort>.
- With
- A LoadBalancer on port 80 whose address is unreachable still gets the loopback fallback
http://localhost:80. - Proxy URLs:
- With kubeconfig server
https://example.com/k8s/clusters/c-1,resolve_proxy_targetkeeps/k8s/clusters/c-1before/api/v1/namespaces/monitoring/services/prometheus:9090/proxy/....resolve_proxy_connectiongives basehttps://example.comand a prefix startingk8s/clusters/c-1/api/v1/. A%2Fin the server's path reaches the prefix unchanged. - A suffix
a%2Fbstaysa%2Fb, and the TLS target stayshttps:argocd-server:443. Suffixesfoo:bar,.hiddenanda..bpass the dot-segment test and are sent on the Service's proxy path. - These are refused with
ServiceAddressErrorbefore any request, and a fake transport records no request:service-url prometheus -n monitoring --port 9090 --path ../../../secrets/foo, with and without--fetch;service-url prometheus -n monitoring --port 9090 --path ../grafana:80/api/health --fetch;--port '9090/../../secrets/foo?'and--port '9090?';- the configured
k8s://monitoring/prometheus:9090/../../../secrets/foo; - a
get_jsonpath containing..,.or%2e%2e, for ak8s://URL and for a direct URL; - namespace or service
...
ServiceRef(namespace="monitoring", service="prometheus", port="9090", path="../grafana:80/api/health")raisesServiceAddressError. Nodescribe()call can return a rewritten address.devops k8s service-url .. -n ..prints the error and exits 1 with no traceback: underCliRunner, the exit code is 1 andresult.exceptionis aSystemExit.describe()without a query has no trailing?._transport_keygives one key forhttps://example.com/a,https://EXAMPLE.com:443/bandhttps://u:[email protected]/c.
- With kubeconfig server
- Probe:
--pathvalueshealthand/healthboth probe/health,api?x=1keeps its query, andfoo:barprobes/foo:baras today.--path //other.example.com/xand--path http://other.example.com/xare sent to the target's host. A second host name is the point of these rows.- Target
https://example.com:8443probeshttps://example.com:8443/health, and its OpenAPI base ishttps://example.com:8443. Targethttps://example.comprobeshttps://example.com/health.127.0.0.1:9090and a sandbox instance's bindings are probed over http, as today. - Target
[::1]:8080probeshttp://[::1]:8080/health. fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112's_parse_target_endpointrows pass unchanged.
- IPv4 builds are unchanged. These pass as they are:
tests/test_k8s.py:702-885,tests/test_k8s_service.py:185and:430, andtests/test_telemetry_collector_export.py:61. - Proxy behaviour that is pinned today still holds. These keep passing, and the PR explains any expected value it changes:
tests/test_k8s_service_proxy.py:64-150(including the round trip at:147-150),tests/test_k8s_proxy_addressing.py:54,tests/test_qdrant_cluster_addressing.py:36-68andtests/test_http_connection_pool.py:227-234. - No construct left:
rg -n '://\{' src/devops_cli/commands/k8s/networking.py src/devops_cli/k8s/service.py src/devops_cli/k8s/service_proxy.py src/devops_cli/k8s/service_http.py src/devops_cli/telemetry/collector.py src/devops_cli/sandbox/probe.pyprints only the dry-run placeholder atnetworking.py:590;proxy_path,resolve_proxy_target,describe(),get_jsonand the probe append paths only throughappend_path;- the dot-segment test compares httpx2's two builds: no split of a path on
/and no comparison with"."or".."is added, and--addressis not split; - with feat(ci): hand-rolled URL and address parsing fails
devops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107 landed, nonet-*marker is left on the lines this item rewrites (thenet-url-buildmarkers on the builders included), and feat(ci): hand-rolled URL and address parsing failsdevops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107'sDEFAULT_NET_CONSTRUCT_SUPPRESSION_CEILINGdrops by the number removed, in the same PR.
- All tests are offline: no network, DNS or cluster. Together the new tests take well under 1 s, and
uv run devops cipasses. The release note goes in achangelog.dfragment. - Pending a person: on a dual-stack or IPv6-only cluster, if one is available,
devops k8s configure-urlswrites bracketed URLs that the dashboard reaches.
Key questions
- Should dot segments be refused whatever the caller? Proposed: yes, for every path that reaches the proxy or
get_json. That covers aServiceRefbuilt from a configuredk8s://value or from--path,proxy_pathoverrides, andget_jsonpaths, including the percent-encoded%2e%2e. No caller has a reason to leave the Service's proxy prefix. How the API server treats encoded dot segments was not measured, so the encoded form is refused too. The probe's--pathis left alone, because it carries no credential. - Why is the dot-segment test httpx2's normalisation and not a segment check? Decided (owner, 2026-10-03): fixes use reputable libraries and tools, never new hand-rolled parsers, prefix tests or regex validators. The escape comes from httpx2's RFC 3986 normalisation, so the test asks that same code whether it would rewrite the path. A split on
/compared with.and..would be a second, hand-written reading of the path. The same rule keeps--addressunsplit. - Why not the kubernetes client's
connect_get_namespaced_service_proxy_with_path? Proposed: do not use it.- In kubernetes 36.0.3 it fills
{path}withquote(path, safe=configuration.safe_chars_for_path_param), and that setting defaults to'', so every/in the proxied path becomes%2F. - Its
path2argument is sent as a query parameter namedpath, not as a query string. - The Qdrant client needs a base URL plus a prefix (
service_proxy.py:275-302), which that call cannot provide. - httpx2 is already the transport (
service_http.py:53-56).
- In kubernetes 36.0.3 it fills
- Where do the new functions live? Proposed:
append_pathgoes in the URL module fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 adds for its origin helper (http/urls.pyin that item), becausek8s/andsandbox/both use it. The dot-segment test and theServiceRefchecks stay ink8s/service_proxy.py. This item adds no module. - Who reads the probe target's scheme? Proposed: fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 reads it once, into the
httpx2.Originit returns. This item uses that origin where the probe URLs are built (probe.py:515,:527), because it rewrites those lines. Until this item lands, probes stay on http, as today. - May
configure-urlschange the written form of a URL it rediscovers? Proposed: yes. The project is pre-1.0, with no compatibility guarantee, and the new form names the same URL (RFC 3986 section 6.2.3) and is what httpx2 sends.- A port-80 LoadBalancer is now written as
http://192.0.2.10instead ofhttp://192.0.2.10:80._should_update_url(networking.py:280-296) sees a different string once and rewrites the value. - Host case and internationalised forms do not change in practice: Kubernetes API validation accepts an Ingress host, and a LoadBalancer host name, only as a lower-case DNS-1123 name.
- A port-80 LoadBalancer is now written as
Strategic alignment
- Priority P2. IPv6 clusters break
configure-urls. A--path, a--portor a namespace can reach any API path with the kubeconfig credential, the Secret read endpoint included. - Proposed milestone: backlog (P2), picked by the release-start fill. It waits for fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897 (v0.2.27), fix(k8s): tunnel sync and url setup still overwrite settings they should keep #794 (v0.2.28), fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 (v0.2.29), fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887 and fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112, which edit its files first.
- Size: medium.
- Dependencies: these items share files, so they land in order:
commands/k8s/networking.py: fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897, fix(k8s): tunnel sync and url setup still overwrite settings they should keep #794, fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887, fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112, this item, fix(valkey): one validated URL names every Valkey endpoint, valkey-py dials an address that one check vetted, and the unused cache layer goes #1113;sandbox/probe.py: fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898, fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112, this item;- fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 also adds the URL module that holds
append_path, and the probe origins this item consumes; - feat(ci): hand-rolled URL and address parsing fails
devops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107 adds thenet-*markers and the ceiling this item lowers.
- Related:
- fix(k8s): the pyroscope Service alias collides with the pyroscope Helm release's own Service, so a fresh deploy-stack can't install Pyroscope #1104 (which absorbs chore(k8s): drop the kube-prometheus-stack service aliases #818) also edits
commands/k8s/networking.py(theprome-prometheuspatterns at:500and:702) and theservice_proxy.py:314docstring. It renames the fixture intests/test_k8s_proxy_addressing.py:45-68whose expecteddescribe()string this item pins at:54. Whichever lands second adopts the other's expected value. - fix(k8s): tunnel sync and url setup still overwrite settings they should keep #794 (v0.2.28) edits
_should_update_urland gateway discovery innetworking.py. - fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 (credential masking) and fix(ai): replies carry their server as an httpx2 origin, so a password in an AI URL stays out of output, the spend ledger, metrics, spans and cache #1110 (the backend origin as a field) are the other two parts of the same URL-handling audit.
- fix(k8s): the pyroscope Service alias collides with the pyroscope Helm release's own Service, so a fresh deploy-stack can't install Pyroscope #1104 (which absorbs chore(k8s): drop the kube-prometheus-stack service aliases #818) also edits
- Shared files: no
CHANGELOG.mdorROADMAP.mdedits; use achangelog.dfragment.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Placed in v0.2.32 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: URLs and host keys read by the library that dials, ollama hardening, and pull-request test-quality tooling. Position 2 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
fix(k8s): service URLs bracket IPv6 hosts and proxy boundaries (#1111)
fix(k8s): service URLs bracket IPv6 hosts and proxy boundaries (#1111) (
dan-petty-bot commentedon Oct 9, 2026
What changed
#1509, merged into
release/v0.2.32as dff7004.9 file(s) changed.
How it was verified
Check runs at db093f1:
Acceptance Criteria of
docs/agent/tasks/task-1111-ipv6-service-urls-and-proxy-boundaries.md:No Acceptance Criteria section.
feat(release): v0.2.32 (#1516)