diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-10-04 12:29:31 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-10-04 12:29:31 +0300 |
| commit | 7f7c730cb415f6b1b22abe5788a10e02c50778ad (patch) | |
| tree | 5aac8631f6a93b32d2cee4a83632dd9750c6be30 /src/migration-scripts/https | |
| parent | bc1a054e14eaabd17326d63fa99c19c0a867130d (diff) | |
| download | vyos-1x-7f7c730cb415f6b1b22abe5788a10e02c50778ad.tar.gz vyos-1x-7f7c730cb415f6b1b22abe5788a10e02c50778ad.zip | |
http-api-client: T8955: harden verify_tls handling
Address the adversarial-review findings on the TLS verification change:
- Finding 1: validate ApiClientConfig.verify_tls in __post_init__. Only a
bool or a non-empty CA bundle path is accepted; anything else (including
"", None and ints) raises ValueError. requests treats "" as falsy and
would silently disable verification. Strings are never coerced: "false"
is a path, so callers must pass a real bool.
- Finding 2: stop calling urllib3.disable_warnings() process-wide from
ApiClient.__init__. InsecureRequestWarning is now ignored only around the
request itself, via warnings.catch_warnings(), and only when verify_tls
is False. post() is the only request path in the client.
- Finding 3: wrap OSError (raised by requests' cert_verify for a missing
CA bundle path) in ApiTransportError. The handler sits after the
RequestException handlers, since those subclass OSError.
- Finding 4: config-sync hard-codes verify_tls = False instead of reading
an unmapped 'verify_tls' key from the runtime config, whose leaf values
are strings. Mapping a CLI option to a bool or CA path is T9396.
🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'src/migration-scripts/https')
0 files changed, 0 insertions, 0 deletions
