Repository navigation
Description
Problem
A numeric setting given through an environment variable is stored as the raw string, and its range is never checked. _coerce_setting_value (config) passes a float setting's string from the environment through unchanged. So, for example, DEVOPS_CLI_VALKEY_TIMEOUT=30 and DEVOPS_CLI_AI_TASK_EMBEDDING_TIMEOUT=30 load as "30", and a negative, zero, infinite or non-numeric value loads without error, failing later, far from the setting.
Found on 2026-10-02 while adding qdrant.timeout (#975). That setting avoids the problem through validate_assignment=True on its model, but the other models do not have it.
Acceptance criteria
- Every numeric setting set from the environment is parsed to its declared type and checked against its field constraints at load. A bad value raises
ConfigurationErrornaming the variable. - Either
_coerce_setting_valuecoerces through the field's type, or every settings model validates on assignment, applied consistently. - Timeout-like fields refuse zero, negatives, infinity and NaN.
- An offline parametrized test covers every numeric option in
OPTION_TO_ENV_VAR: a valid value loads as its type, and"0","-1","inf"and"x"are refused where the field forbids them. uv run devops cipasses.
Problem (scope added 2026-10-03)
This scope is posted on #992, a sub-issue of #1000 that lands first (consolidation, 2026-10-03). #992's numeric criteria stay; this scope widens the same mechanism to booleans, URLs and lists. Proposed retitle, for a person: "every settings value passes its field type at load and on set".
Scope added 2026-10-03, under the library rule that #1107 enforces. Lines cited at dcafadf. Every URL setting is a bare str that nothing checks as a URL. Values from the environment and from devops config set reach the models without going through their field types. _coerce_setting_value parses booleans and decides whether a value is a list by hand. This scope makes the field type the one check for every value, using pydantic, httpx2 and the standard library, and adds no dependency.
Measured offline, in a network namespace with no network (pydantic 2.13.5, pydantic-settings 2.15.0, httpx2 2.13.0, opentelemetry-exporter-otlp-proto-grpc 1.44.0, Python 3.14.7):
DEVOPS_CLI_TELEMETRY_ENABLED=bogusandDEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK=bogusload asFalsewith no error, and=yalso loads asFalse. The bool branch of_coerce_setting_value(config/settings.py:1145-1146) strips the value and tests membership in{"1", "true", "yes", "on"}. It is the fourth parser of the private-network flag. fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 deletes the other three (http/broker.py:31-35,core/validation.py:297-302,ai/client/unified.py:344-352) and reads this field instead.DEVOPS_CLI_GRAFANA_URL=example.comloads unchanged.DEVOPS_CLI_AI_OLLAMA_URLS=localhost:11434also loads, andget_ollama_urls(:503-514) addshttp://to it. ForHTTP://example.com:11434it returnshttp://HTTP://example.com:11434(:513)._apply_env_overrides(:758-779) anddevops config set(commands/config.py:184-203) both go throughdotted_set(:1158-1186). It assigns withsetattron models that do not validate assignment; onlyQdrantConfigdoes (:183).ai.temperature=0.5is stored as the string'0.5', andai.timeout=abcas'abc'. This item's original body is that numeric half.dotted_settreats a value as a list when the key ends ins(:1185):devops config set cloudflare.public_ip_bypass 192.0.2.1stores['192.0.2.1']in astr | Nonefield (:342,:366).save_settings(:1021) writes that list to config.yaml. The nextSettings.model_validaterefuses it, so every later command that loads settings fails.ai.gateway_weights, a dict field, gets a list the same way.
- Typing the fields as bare
AnyHttpUrlbreaks callers, because the value is no longer astr:.rstrip("/")fails atcommands/argo.py:178,argo/fleet.py:55andcommands/grafana.py:84;", ".join(...)fails atcommands/k8s/networking.py:333and:336;save_settings(model_dump(mode="json")) would writehttp://host:port/, with a trailing slash, back to config.yaml.
- A pydantic check on a value that is then sent as written can disagree with the client that sends it. pydantic parses URLs the WHATWG way; httpx2, which sends them, follows RFC 3986.
- pydantic accepts
http:example.com,http:/example.com,http://example.com\v1, a value with an embedded tab, andhttp://2852039166:11434. For these, httpx2 has an empty host (itsURL.originthen raisesValueError), raisesInvalidURL, or dials a different host. - For
https://api.openai.com\@example.com/v1, pydantic reads the host asapi.openai.com; httpx2 reads it asexample.com. httpx2.InvalidURLsubclassesException, notValueError(its MRO isInvalidURL, Exception). pydantic turns onlyValueError,AssertionErrorand its own error types into validation errors. A validator that callshttpx2.URL(v)without catching it letInvalidURLescape validation forhttp://exa\tmple.com:11434._apply_env_overrides(:775) andconfig set(commands/config.py:201) catch only(AttributeError, ValueError), soload_settingswould crash rather than refuse the value.
- pydantic accepts
- Seven of the URL fields also hold cluster service addresses.
devops k8s configure-urlsproxy addressing writesk8s://<namespace>/<service>:<port>(ork8s+https://for TLS) intoargocd.url,grafana.url,prometheus.url,jaeger.url,pyroscope.url,open_webui.urlandqdrant.url(commands/k8s/networking.py:497-537).- An http(s)-only type would refuse values the CLI writes itself.
- The test of that path patches
dotted_set(tests/test_k8s_proxy_addressing.py:129-145), so it would stay green.
- pydantic's default error text repeats the input, so a refused
http://u:s3cret@…value printss3cret.hide_input_in_errors=Trueremoves the input, but only on the model whose validation raises:- A config.yaml value fails inside
Settings.model_validate(raw)(:903). There the outermost model,Settings(SettingsConfigDict,:633-637), decides. A section model that hides input under aSettingsthat does not still printedinput_value='http://u:s3cret@exa mple.com'. - An assignment through
dotted_setfails inside the section model, so the section's setting decides. ASettingsthat hides input over a section that does not still printeds3creton assignment. - With both set, neither path printed
s3cret. hide_input_in_errorsdoes not change the text of aValueErrorthat a validator raises. Everyparse_service_urlmessage embeds the whole value (k8s/service_proxy.py:111-129). Fork8s://u:s3cret@monitoring/prometheusit raises'k8s://u:s3cret@monitoring/prometheus' is missing a service port. ….
- A config.yaml value fails inside
- Today the bool branch strips whitespace first (
:1146), so' true 'and'true\r'(from a CRLF env file) load asTrue. pydantic's bool parsing refuses both, even withstr_strip_whitespace=True.
Acceptance criteria (scope added 2026-10-03)
Deliverable. Each piece is a call into pydantic, httpx2 or the standard library:
-
One str-preserving alias for http(s) URL fields:
Annotated[str, StringConstraints(strip_whitespace=True), AfterValidator(...)].- The validator runs
TypeAdapter(AnyHttpUrl).validate_python(v)to check the shape: scheme http or https, a host, a valid port and IDN. - It then requires
httpx2.URL(v).origin == httpx2.URL(str(parsed)).origin, and returns the strippedvunchanged. What is stored and saved is what the user wrote. - It catches
httpx2.InvalidURLfrom eitherhttpx2.URL(...)call and raisesValueErrorwith a reason that does not repeat the value (for examplehttpx2 cannot parse this URL). An origin mismatch raisesValueErrorthe same way (for examplehttpx2 would send this URL to a different host or port). TheValueErrorthat.originraises for an empty host does not contain the value either, so pydantic records it as it is. - Measured offline, the alias accepted
http://example.com:11434,HTTP://Example.COM:11434,http://[::1]:11434,http://bücher.example:11434andhttps://example.com:443/v1.bücher.exampleis a reserved non-ASCII name because that case tests IDN; every other mock host isexample.com. - With the
InvalidURLcatch in place, it refused every disagreement case above as a validation error. It also refused scheme-less values (URL scheme should be 'http' or 'https') andgrpc://.
- The validator runs
-
A service-URL alias for the seven fields:
- A value whose scheme
is_service_urlrecognises (k8s/service_proxy.py:97-99) must passparse_service_url(:102-138). ItsServiceAddressError(aKubernetesError,:45) is re-raised asValueError, so pydantic records the key. - The re-raised
ValueErrorcarries only the reason, never the URL or any part of it.parse_service_url's messages (:111-129) change to state the reason alone, for examplemissing a service port; a Service may expose several, so the port is required rather than guessed. A caller that shows the error for an address it holds names the key or the address itself.tests/test_k8s_service_proxy.py:125-128matches onportand still passes. - Any other value goes through the http(s) alias.
k8s://is devops-cli's own scheme, so no library parses it. The alias reuses the one existing parser rather than adding another.
- A value whose scheme
-
Every section model sets
validate_assignment=Trueandhide_input_in_errors=True, andSettings(itsSettingsConfigDict) also setshide_input_in_errors=True. The setting on the outermost model being validated governs:Settingsfor config.yaml, the section for an assignment.- Booleans, numbers, paths and URLs from the environment and from
config setthen go through pydantic's own parsing. - Booleans accept
true/false,1/0,yes/no,on/off,y/nandt/f, in any case, and refusebogus. They also refuse surrounding whitespace, so' true 'and'true\r'are now refused, naming the key. _coerce_setting_valuekeeps only the comma split for list fields.- A field is a list when
typing.get_origin(annotation) is list, or when the annotation is a union (typing.Unionortypes.UnionType) one of whosetyping.get_argsmembers has originlist. Measured offline, this rule givesTruefor bothlist[str]andlist[str] | None, andFalseforstr | Noneanddict[str, int]. _typed_placeholder(:1200-1210) is not the model to copy. It runstyping.get_args(annotation) or (annotation,)first, so a barelist[str]becomes(str,)and is not seen as a list.ai.ollama_urls(:454) andcloudflare.access.bypass_ips(:338) are barelist[str]. Its one caller isdotted_set(:1184). Once coercion reads the annotation it has no caller left and is deleted.
- Booleans, numbers, paths and URLs from the environment and from
-
Constraint: no pydantic-based check whose canonical form differs from the value actually sent. Nothing reads a host from pydantic's parse. Host and trust decisions stay with the sending client's parser (fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897, 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).
-
Field types:
- The http(s) alias types
telemetry.endpoint(:290),ai.ollama_urls(:454),ai.gateway_url(:457),ai.portkey_url,ai.vllm_urlandai.api_base_url(:461-463), and the task overrides'ollama_urlsandapi_base_url(:416,:418). - The service-URL alias types
grafana.url,prometheus.url,argocd.url,qdrant.url,open_webui.url,jaeger.urlandpyroscope.url(:168,:173,:178,:184,:200,:277,:282). - Every value stays a
str. - No
httpx2.InvalidURLand noServiceAddressErrorleaves validation: each arrives as aValidationErrornaming the key.
- The http(s) alias types
-
Every section model validates assignment and hides input in errors, and
Settingshides input in errors._coerce_setting_value(:1141-1155) keeps only the list split.dotted_setdecides list input from the field's annotation, by the union-aware rule above, not from the last letter of the key (:1185).ai.ollama_urls,cloudflare.access.bypass_ipsandai.tasks.<task>.ollama_urlsall split on commas. -
An offline, parametrised old-vs-new test runs each row through
load_settingswith environment variables, through config.yaml and throughdotted_set:
| Input | Path | Today | After |
|---|---|---|---|
DEVOPS_CLI_TELEMETRY_ENABLED=bogus, DEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK=bogus |
environment | False, no error |
refused, naming the variable |
DEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK=y |
environment | False |
True |
DEVOPS_CLI_TELEMETRY_ENABLED=' true '; DEVOPS_CLI_TELEMETRY_ENABLED='true\r' |
environment | True |
refused, naming the variable |
DEVOPS_CLI_AI_OLLAMA_URLS=localhost:11434 |
environment | loads, read as http://localhost:11434 |
refused: ai.ollama_urls.0 |
DEVOPS_CLI_GRAFANA_URL=example.com |
environment | loads | refused: grafana.url |
ai.ollama_urls = http://example.com:11434, localhost:11434 |
config set |
saved | refused: ai.ollama_urls.1, file unchanged |
HTTP://example.com:11434 in ai.ollama_urls |
file | read as http://HTTP://example.com:11434 |
loads; get_ollama_urls adds no scheme |
http://example.com:11434 |
every path | loads | loads; saved byte-identical, no trailing slash |
http://example.com:11434/ in ai.ollama_urls |
config set, file |
loads; get_ollama_urls returns http://example.com:11434 |
saved as written; get_ollama_urls returns http://example.com:11434 |
http:example.com, http://example.com\v1, http://2852039166:11434 |
config set, file |
loads | refused |
http://exa\tmple.com:11434 (embedded tab) |
config set, file, environment |
loads | refused as a validation error naming the key; no InvalidURL escapes |
https://api.openai.com\@example.com/v1 as ai.api_base_url (two different hosts are the point of this row) |
file | loads | refused |
k8s://monitoring/prometheus:9090 in prometheus.url; k8s+https://argocd/argocd-server:443 in argocd.url |
config set, file |
loads | loads, unchanged |
k8s://monitoring/prometheus (no port) in prometheus.url |
config set |
loads | refused, with parse_service_url's reason and without the URL |
k8s://u:s3cret@monitoring/prometheus (no port) in prometheus.url |
every path | loads | refused; no error text contains s3cret |
grpc://example.com:4317, example.com:4317 in telemetry.endpoint |
file, environment | loads | refused, naming the key (see the key question on telemetry.endpoint) |
ai.temperature=0.5; ai.timeout=abc |
config set |
'0.5' (a str); 'abc' |
0.5 (a float); refused |
ai.timeout=0, ai.timeout=-1, ai.timeout=inf, ai.timeout=nan |
config set, file, environment |
loads | refused, naming the key |
cloudflare.public_ip_bypass=192.0.2.1 |
config set |
['192.0.2.1']; the next load fails |
'192.0.2.1'; the next load succeeds |
ai.gateway_weights=a=1 |
config set |
['a=1'] in a dict field |
refused |
http://u:s3cret@exa mple.com |
every path | loads as a plain str |
refused; no error text contains s3cret |
- Timeout-like fields (timeouts,
*_secondsdurations and intervals) carry field constraintsgt=0andallow_inf_nan=False.validate_assignmentalone does not refuse0,-1,inforNaN, and today_coerce_setting_value(:1141) parses an integer withint()without a range check and leaves a float as a string. The PR lists the fields it constrains. - A refused value is reported on one line with the full dotted key, the list index and pydantic's reason, for example
ai.ollama_urls.1: URL scheme should be 'http' or 'https'.- The line is built from
ValidationError.errors(include_url=False, include_input=False). - An environment value also names its variable, as
_apply_env_overridesalready does (:775-779). - A config.yaml value that fails to load names its key.
- No error repeats the value: neither pydantic's input (hidden by
hide_input_in_errorsonSettingsand on each section) nor a validator's ownValueErrortext. A config file that does not parse is reported without its text: the file, the error class, the line and the column, never the snippet. fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022 (the secrets audit never prints a config line it cannot parse) is proposed to own that one config-file reader forload_settings,audit-keysand the SSH key-prefix lookup (consolidation proposal, for a person to accept); whichever of fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022 and this scope lands first adds it, and the other uses it.
- The line is built from
-
devops config setanddevops ai configexit 1 on a refused value, naming the key, and leave config.yaml unchanged. Todaycommands/ai.py:462calls_apply_ai_settingsoutside anytry. - No in-place mutation skips validation:
settings.ai.ollama_urls.append(...)atcommands/k8s/networking.py:335becomes an assignment. - Proxy addressing survives a round trip.
_configure_proxy_urlswrites into a realSettings, withdotted_setnot patched. It recordsk8s://monitoring/prometheus:9090and the Qdrant address, andsave_settingsfollowed byload_settingsreturns both unchanged. - Telemetry stays fail-closed (fix(docs): generated docs mask non-secret defaults and hide off flags, and docs name things that do not exist #956):
- With
DEVOPS_CLI_TELEMETRY_ENABLED=bogus, or withDEVOPS_CLI_TELEMETRY_ENDPOINT=localhost:4318,load_settings()raisesConfigurationErrornaming the variable. - In the same cases,
_resolve_telemetry_settings()(telemetry/tracer.py:1272-1284) returns export off without raising. - Today the fallback
telemetry_from_environment()(config/settings.py:914-923) is called outside thetry, so it would raise once these values are refused. - The rows join the parametrised test at
tests/test_config_env_overrides.py:257-298.
- With
- Two tests set
ai.api_base_urltolocalhost:8000/v1to reach the use-time check atai/pydantic_ai_bridge.py:141-147:tests/test_pydantic_ai_durable.py:400-418andtests/test_pydantic_ai_profiles_and_providers.py:652-662.- Both switch to a value the type accepts and the use-time check refuses:
http://169.254.169.254/v1. Measured offline,create_pydantic_ai_providerraisesSSRFBlockedErrorfor it with or withoutallow_private_network. - A new row shows
localhost:8000/v1refused on assignment, namingai.api_base_url.
- Both switch to a value the type accepts and the use-time check refuses:
-
get_ollama_urls(:503-514) adds no scheme. Only thehttp://prefix at:513goes. The trailing-slash trim and the empty-entry skip (:510-512) stay, and so does the empty-list fallback (:505-506,:514). Callers append paths to the base directly (f"{base}/api/chat"atai/client/ollama.py:308and:464,f"{base_url}/api/embed"atai/rag/embeddings.py:234), so a saved trailing slash must not reach them. If feat(ci): hand-rolled URL and address parsing failsdevops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107 has landed, the scheme-test marker on:513is removed and the ceiling is lowered. - These pass unchanged:
tests/test_config_env_overrides.py:16-40and:84-110,tests/test_config_commands.py:243-255andtests/test_k8s_service_proxy.py:108-128. A comma-separatedDEVOPS_CLI_AI_OLLAMA_URLSstill loads as a list.- URL settings refuse a value without
http://orhttps://(for the seven service URLs, alsok8s://ork8s+https://). This applies to the file, the environment andconfig set, and the error names the key. - Booleans outside pydantic's spellings are refused, and
y/t/n/fare now read. A boolean with surrounding whitespace, such as' true 'or a trailing carriage return from a CRLF env file, is now refused, naming the key. - Cluster service address errors no longer repeat the address.
telemetry.endpointrefusesgrpc://and barehost:portvalues. Writehttp://host:4317for a plaintext collector andhttps://host:4317for TLS.- The fix is to correct the value by hand. The PR edits no user's config.yaml.
- URL settings refuse a value without
- Pending a person: run
devops config showon the devcontainer, and on any other workstation config, after the change. Fix any key the new types refuse by hand in config.yaml.
Key questions (scope added 2026-10-03)
- Which parser decides whether a URL setting is accepted? Proposed: both, as above.
- pydantic's
AnyHttpUrlchecks the shape, and httpx2'sURL.originequality makes sure the accepted value is the one the client sends. - pydantic alone accepts forms that httpx2 sends elsewhere (rows above).
- httpx2 alone accepts port 99999, an empty host (
http://) andhttp://exa mple.com. - Returning pydantic's re-serialised string would change what is saved, so the validator returns the input.
- pydantic's
- Does
telemetry.endpointtake the http(s) alias? Proposed: yes.- The OTLP gRPC exporter's own default is
http://localhost:4317, and it takes TLS from the scheme:httpsis secure,httpis insecure (opentelemetry-exporter-otlp-proto-grpc 1.44.0,exporter.py:310-324). So an http(s) URL serves both OTLP transports. grpc://and barehost:4317values load today and are sniffed bytelemetry/tracer.py:705-711. After this change they are refused, naming the key, and the changelog says what to write instead. Before 1.0 no shim keeps the old spellings.- The only value devops-cli writes into this key is
http://<jaeger host>:4318, fromdevops k8s configure-urls(commands/k8s/networking.py:411-416), and the alias accepts it. - OpenTelemetry's own
OTEL_EXPORTER_OTLP_ENDPOINT, read when the setting is unset (tracer.py:1301-1303), is not a devops-cli setting and is not typed here. 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 owns how the tracer reads either value, and itsgrpc://and bare-endpoint rows still apply to that variable.
- The OTLP gRPC exporter's own default is
- What about
valkey.urlandruns.index_url(:255,:248)? Proposed: not here. They are Valkey URLs (valkey://orvalkeys://), not HTTP ones. 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 moves the Valkey client to Valkey GLIDE (the sync client,valkey-glide-sync), removes thevalkey.host,valkey.portandvalkey.dbsettings, keeps these two URLs as the only Valkey endpoint settings, and refuses a malformed one naming its key. This scope only adds the section flags toValkeyConfigandRunsConfig. - Is userinfo in a URL setting allowed? Proposed: yes, as today, since an Ollama behind basic auth is a supported setup.
- 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 keeps it out of display.
- fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 masks it in output.
hide_input_in_errorsonSettingsand on every section keeps it out of pydantic's errors. Validator messages, includingparse_service_url's, never contain the value.
- How does a user whose config.yaml now fails to load recover? Proposed: the error names the key, and the user edits the file, guided by the changelog. Nothing rewrites the file automatically: the PR adds no migration (pre-1.0, no compatibility shims).
- Does the
dotted_setdefect wait for the rest of this scope? Proposed: yes; it ships with this scope as its first commit, because it needs none of the URL work. Todayconfig setoncloudflare.public_ip_bypass,cloudflare.access.public_ip_bypassorai.gateway_weightswrites a config.yaml that no later command can load. No other key reaches the list branch by mistake, because the bool, int and path branches come first (:1143-1148), and editing config.yaml recovers. That does not justify a separate fix ahead of refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000. - Does this need an order with fix(config): numeric settings from environment variables load as strings and are never range-checked #992, 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, fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111, 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 or the rest of refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000? Proposed: only on shared files.
- This item's numeric criteria and this scope use the same mechanism and land in one PR, before refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's registry rework.
- 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 lists
get_ollama_urlsandk8s/credentials.py:26-33. The field type is where a scheme-less setting is refused, so if 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 lands first with a refusal in the property, this scope moves it into the type. commands/k8s/networking.pyis edited in turn by 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, fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111 and 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. This scope changes one line there (:335), so it takes no place in that order: whichever lands later rebases over that line.k8s/service_proxy.py: fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111 addsServiceAddressErrormessages whenServiceRefchecks its own fields, by re-raisingvalidate_k8s_identifier, whose text names the identifier (core/validation.py:458-460). Whichever of the two lands second makes those messages follow the reason-only rule above.- "Every section model" includes
ValkeyConfigandRunsConfig(:242-272), which 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 rewrites, deletingValkeyConfig'smode="before"model validator (:261-272). If this scope lands first, that validator also runs on each assignment. Measured offline, a single assignment is kept as given (valkey.hostset toexample.comstaysexample.com, andvalkey.portset to 7000 stays 7000). Settingvalkey.portto 7000 aftervalkey.hostisexample.comrewrites the host toexample.com:7000at once, which is what the next load does today. Whichever of the two lands second carries both config flags onto the model it finds. - refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's own first key question may replace
_apply_env_overrideswith pydantic-settings sources. Environment values are then validated bySettingsrather than assigned, and theSettings-levelhide_input_in_errorscovers them. The criteria that name_apply_env_overridesordotted_setthen apply to whatever sets the value in their place, and the table rows stay as written.
Strategic alignment (scope added 2026-10-03)
- Priority: P2, as this item and refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000.
- Library first: pydantic's URL type and boolean parsing, httpx2's URL parser and
typingreplace the hand-written boolean set, the key-suffix list rule and the scheme prefix. Only the comma split for list input and the existing parser for devops-cli's ownk8s://scheme stay. - No new dependency: pydantic 2.13.5, httpx2 2.13.0 and pydantic-settings 2.15.0 are direct, exact-pinned dependencies (
pyproject.toml:15,:19,:27).typingandtypesare standard library. - Related:
- fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898: deletes the other three flag parsers and reads
ai.allow_private_network; - fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897: host classification;
- refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000: the parent (one declaration per settings field); it keeps the registry rework and the proposed
extra='forbid'rule; - fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022: the config-file reader that never prints a value (proposed);
- fix(docs): generated docs mask non-secret defaults and hide off flags, and docs name things that do not exist #956 (shipped in v0.2.25): telemetry export stays off when settings cannot load;
- fix(k8s): tunnel sync and url setup still overwrite settings they should keep #794 and fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887: earlier edits to
commands/k8s/networking.py; - 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, 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, fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109, 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, fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111, 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.
- fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898: deletes the other three flag parsers and reads
Update 2026-10-08: refinement
Under #1165's rule, get_ollama_urls' localhost fallback (config/settings.py:521-532) is not this item's to keep: it removes only the http:// prefix (:531), and an empty ai.ollama_urls is #1165's error. It adds no URL default. #898 landed, so the bool branch (:1273-1274) is the only parser of DEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK, and =bogus still loads as False.
Proposed design
Problem statement
Numeric settings from environment variables are loaded as strings and not range-checked, leading to late failures far from the source. Boolean, URL, and list settings also suffer from inconsistent validation, with values bypassing field type checks during assignment or load.
Acceptance criteria
- Criterion 1: Every numeric setting set from the environment is parsed to its declared type and checked against its field constraints at load, raising ConfigurationError naming the variable for bad values.
Verification: Runuv run devops ciand verify that a bad numeric value in an environment variable raises ConfigurationError with the correct variable name. - Criterion 2: Timeout-like fields refuse zero, negatives, infinity and NaN values.
Verification: Set DEVOPS_CLI_AI_TASK_EMBEDDING_TIMEOUT to 0, -1, inf, or nan and confirm that it raises a ConfigurationError naming the key. - Criterion 3: An offline parametrized test covers every numeric option in OPTION_TO_ENV_VAR with valid values loading as their type and invalid values being refused.
Verification: Execute an offline test covering all rows from the acceptance criteria table, confirming correct behavior for each input path (environment, config file, config set). - Criterion 4: Boolean values from environment variables are parsed correctly and refuse non-standard spellings like 'bogus' or 'y'.
Verification: Set DEVOPS_CLI_TELEMETRY_ENABLED to 'bogus', 'true\r', or ' true ' and verify the correct behavior (refusal or parsing) for each case. - Criterion 5: URL fields validate inputs using both pydantic's AnyHttpUrl and httpx2's URL.origin equality, ensuring the accepted value matches what the client sends.
Verification: Test with URLs like 'http://example.com\v1'or 'https://api.openai.com\@example.com/v1'and confirm they are refused as validation errors naming the key. - Criterion 6: devops config set exits 1 on a refused value, naming the key, and leaves config.yaml unchanged.
Verification: Run 'devops config set ai.timeout abc' and confirm it exits with code 1 and doesn't modify config.yaml.
Key questions
- Which parser decides whether a URL setting is accepted?: Both pydantic's AnyHttpUrl checks the shape, and httpx2's URL.origin equality makes sure the accepted value is the one the client sends. [sources: src/devops_cli/config/settings.py:1141-1155]
- Does telemetry.endpoint take the http(s) alias?: Yes, because the OTLP gRPC exporter's own default is
http://localhost:4317, and it takes TLS from the scheme. (proposed) [sources: src/devops_cli/config/settings.py:633-637] - What about valkey.url and runs.index_url?: Not here; they are Valkey URLs (valkey:// or valkeys://), not HTTP ones. 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 moves the Valkey client to Valkey GLIDE and removes these settings. (proposed) [sources: src/devops_cli/config/settings.py:255, src/devops_cli/config/settings.py:248]
- Is userinfo in a URL setting allowed?: Yes, as today, since an Ollama behind basic auth is a supported setup. (proposed) [sources: src/devops_cli/config/settings.py:513]
- How does a user whose config.yaml now fails to load recover?: The error names the key, and the user edits the file guided by the changelog. Nothing rewrites the file automatically. (proposed) [sources: src/devops_cli/config/settings.py:1200-1210]
- Does the dotted_set defect wait for the rest of this scope?: Yes; it ships with this scope as its first commit, because it needs none of the URL work. (proposed) [sources: src/devops_cli/config/settings.py:1158-1186]
- Does this need an order with fix(config): numeric settings from environment variables load as strings and are never range-checked #992, 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, fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111, 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 or the rest of refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000?: Only on shared files. This item's numeric criteria and this scope use the same mechanism and land in one PR, before refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's registry rework. (proposed) [sources: src/devops_cli/config/settings.py:758-779]
Open questions
- pydantic's
AnyHttpUrlchecks the shape, and httpx2'sURL.originequality makes sure the accepted value is the one the client sends. - pydantic alone accepts forms that httpx2 sends elsewhere (rows above).
- httpx2 alone accepts port 99999, an empty host (
http://) andhttp://exa mple.com. - Returning pydantic's re-serialised string would change what is saved, so the validator returns the input.
- The OTLP gRPC exporter's own default is
http://localhost:4317, and it takes TLS from the scheme:httpsis secure,httpis insecure (opentelemetry-exporter-otlp-proto-grpc 1.44.0,exporter.py:310-324). So an http(s) URL serves both OTLP transports. grpc://and barehost:4317values load today and are sniffed bytelemetry/tracer.py:705-711. After this change they are refused, naming the key, and the changelog says what to write instead. Before 1.0 no shim keeps the old spellings.- The only value devops-cli writes into this key is
http://:4318, fromdevops k8s configure-urls(commands/k8s/networking.py:411-416), and the alias accepts it. - OpenTelemetry's own
OTEL_EXPORTER_OTLP_ENDPOINT, read when the setting is unset (tracer.py:1301-1303), is not a devops-cli setting and is not typed here. 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 owns how the tracer reads either value, and itsgrpc://and bare-endpoint rows still apply to that variable. - 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 keeps it out of display.
- fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 masks it in output.
hide_input_in_errorsonSettingsand on every section keeps it out of pydantic's errors. Validator messages, includingparse_service_url's, never contain the value.- This item's numeric criteria and this scope use the same mechanism and land in one PR, before refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's registry rework.
- 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 lists
get_ollama_urlsandk8s/credentials.py:26-33. The field type is where a scheme-less setting is refused, so if 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 lands first with a refusal in the property, this scope moves it into the type. commands/k8s/networking.pyis edited in turn by 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, fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111 and 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. This scope changes one line there (:335), so it takes no place in that order: whichever lands later rebases over that line.k8s/service_proxy.py: fix(k8s): service URLs bracket IPv6 hosts, k8s:// addresses reach only their Service, and https probe targets are probed over https #1111 addsServiceAddressErrormessages whenServiceRefchecks its own fields, by re-raisingvalidate_k8s_identifier, whose text names the identifier (core/validation.py:458-460). Whichever of the two lands second makes those messages follow the reason-only rule above.- "Every section model" includes
ValkeyConfigandRunsConfig(:242-272), which 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 rewrites, deletingValkeyConfig'smode="before"model validator (:261-272). If this scope lands first, that validator also runs on each assignment. Measured offline, a single assignment is kept as given (valkey.hostset toexample.comstaysexample.com, andvalkey.portset to 7000 stays 7000). Settingvalkey.portto 7000 aftervalkey.hostisexample.comrewrites the host toexample.com:7000at once, which is what the next load does today. Whichever of the two lands second carries both config flags onto the model it finds. - refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's own first key question may replace
_apply_env_overrideswith pydantic-settings sources. Environment values are then validated bySettingsrather than assigned, and theSettings-levelhide_input_in_errorscovers them. The criteria that name_apply_env_overridesordotted_setthen apply to whatever sets the value in their place, and the table rows stay as written.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 3, 2026
Consolidation (2026-10-03): this item is a sub-issue of #1000 and lands first. Proposed retitle: "every settings value passes its field type at load and on set". The library-first settings amendment (URL, boolean and list typing; posted below as an amendment to this item's body) belongs here, not on #1000.
validate_assignmentandhide_input_in_errorson every section model cover booleans, URLs and lists as well as numbers.Gap to close here:
validate_assignmentalone does not refuse0,-1,inforNaN. So timeout-like fields need field constraints (gt=0,allow_inf_nan=False) to meet this item's criterion. Today_coerce_setting_value(config/settings.py:1141) parses an integer withint()and never checks its range, and leaves a float as a string.dotted_set(:1158) treats a key ending insas a list.refactor(config): settings resolve in one declared order through pyda…