feat: make TLS certificate verification configurable#1893
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a new configuration setting, insecure_skip_tls_verify, and a corresponding environment variable, DEEPSEEK_INSECURE_SKIP_TLS_VERIFY, to allow users to bypass TLS certificate verification for outbound HTTPS requests. This change affects multiple modules, including the CLI update mechanism, skill management, MCP connections, and various network-dependent tools. The review feedback identifies several locations where the skip_verify flag is not properly propagated to internal function calls, specifically regarding mirror-based updates and skill registry synchronization. Furthermore, the reviewer suggests centralizing the environment variable parsing logic to eliminate redundancy and ensure consistent boolean evaluation across the codebase.
| fn fetch_latest_release(skip_verify: bool) -> Result<Release> { | ||
| if let Some(base_url) = release_base_url_from_env() { | ||
| let version = update_version_from_env().unwrap_or_else(|| env!("CARGO_PKG_VERSION").into()); | ||
| return Ok(release_from_mirror_base_url( |
| let (network, _max_size, registry_url, _skip_verify) = installer_settings(app); | ||
| let registry = run_async(async move { install::fetch_registry(&network, ®istry_url).await }); |
There was a problem hiding this comment.
| if let Ok(value) = std::env::var("DEEPSEEK_INSECURE_SKIP_TLS_VERIFY") { | ||
| let val = value.trim().to_ascii_lowercase(); | ||
| config.insecure_skip_tls_verify = | ||
| Some(matches!(val.as_str(), "1" | "true" | "yes" | "on")); | ||
| } |
There was a problem hiding this comment.
804815d to
f60c0fd
Compare
|
Thanks for the review. Here is the status of each comment:
All fixes have been squashed into the latest commit. |
|
Independent review (security-focused, post-greptile fixes) Secure by default — confirmed. Gaps worth addressing:
v0.8.48 conflict (PR #2256). Non-trivial in |
…s, and compilation fixes - Add always-visible TUI warning banner when insecure_skip_tls_verify is active, addressing the 'warning is too quiet' concern - Extract warn_if_insecure_tls() method and add 3 tests covering Some(true)/Some(false)/None paths with tracing subscriber capture - Add insecure_skip_tls_verify field to EngineConfig and wire it through ui.rs, main.rs, and runtime_threads.rs constructors - Fix pre-existing compilation errors: merge_config missing the field, apply_env_overrides called as method (free function), missing skip_verify argument in skill_install integration tests
…s, and compilation fixes - Add always-visible TUI warning banner when insecure_skip_tls_verify is active, addressing the 'warning is too quiet' concern - Extract warn_if_insecure_tls() method and add 3 tests covering Some(true)/Some(false)/None paths with tracing subscriber capture - Add insecure_skip_tls_verify field to EngineConfig and wire it through ui.rs, main.rs, and runtime_threads.rs constructors - Fix pre-existing compilation errors: merge_config missing the field, apply_env_overrides called as method (free function), missing skip_verify argument in skill_install integration tests
fc8ef07 to
cfe1944
Compare
…s, and compilation fixes - Add always-visible TUI warning banner when insecure_skip_tls_verify is active, addressing the 'warning is too quiet' concern - Extract warn_if_insecure_tls() method and add 3 tests covering Some(true)/Some(false)/None paths with tracing subscriber capture - Add insecure_skip_tls_verify field to EngineConfig and wire it through ui.rs, main.rs, and runtime_threads.rs constructors - Fix pre-existing compilation errors: merge_config missing the field, apply_env_overrides called as method (free function), missing skip_verify argument in skill_install integration tests
cfe1944 to
06c12a9
Compare
Add `insecure_skip_tls_verify` configuration option (default `false`) to allow users to disable TLS certificate verification for outbound HTTPS requests. This affects the API client, tools (fetch, search, web_run, finance, image_analyze), skill installer, MCP connections, sandbox, config UI polling, CLI self-updater, and webhook hooks. **Configuration** - TOML: `insecure_skip_tls_verify = true` - Environment variable: `DEEPSEEK_INSECURE_SKIP_TLS_VERIFY=true` **Key design decisions** - The flag is threaded through constructors and execution contexts rather than read from global config inside HTTP client builders, keeping the dependency graph clean (hooks crate does not depend on config). - `ConfigToml::resolve_insecure_skip_tls_verify()` centralizes env-var override resolution so callers don't duplicate parsing logic. - `parse_bool` in `crates/config` is now `pub` for shared boolean parsing. **Tests added** - Config TOML deserialization for `insecure_skip_tls_verify` - Env override application in TUI Config - HTTP client builder behavior with skip_verify true/false **Security note** This commit does not introduce or expose any credentials, tokens, or secrets. All changes are strictly structural (replacing hardcoded `danger_accept_invalid_certs(true)` with a configurable flag). No API keys, passwords, or personal access tokens are present in the diff.
…s, and compilation fixes - Add always-visible TUI warning banner when insecure_skip_tls_verify is active, addressing the 'warning is too quiet' concern - Extract warn_if_insecure_tls() method and add 3 tests covering Some(true)/Some(false)/None paths with tracing subscriber capture - Add insecure_skip_tls_verify field to EngineConfig and wire it through ui.rs, main.rs, and runtime_threads.rs constructors - Fix pre-existing compilation errors: merge_config missing the field, apply_env_overrides called as method (free function), missing skip_verify argument in skill_install integration tests
06c12a9 to
2ce873f
Compare
Addresses P1 review feedback: FinanceTool and ImageAnalyzeTool were hardcoding skip_verify=false in with_web_tools() and with_vision_tools(). Thread the skip_verify flag through the builder chain so both tools respect the user's insecure_skip_tls_verify configuration.
Removes duplicated boolean parsing logic and reuses the now-public parse_bool from the config crate, as suggested in review.
|
All review comments have been addressed. Here's a summary of what was done: P1 — FinanceTool & ImageAnalyzeTool ignore
|
Add
insecure_skip_tls_verifyconfiguration option (defaultfalse) to allow users to disable TLS certificate verification.Configuration:
insecure_skip_tls_verify = trueDEEPSEEK_INSECURE_SKIP_TLS_VERIFY=trueChanges:
.danger_accept_invalid_certs(true)across the workspace with configurable flagsdeepseek-configand TUIConfigNote: TLS verification is enabled by default. Only disable when connecting to servers with self-signed or untrusted certificates.
Greptile Summary
This PR makes TLS certificate verification configurable via
insecure_skip_tls_verify(config file orDEEPSEEK_INSECURE_SKIP_TLS_VERIFYenv var, defaultfalse), replacing all previous hardcodeddanger_accept_invalid_certs(true)calls across the workspace.insecure_skip_tls_verifyto bothConfigToml(crates/config) and TUIConfig, with env-override support, a load-timetracing::warn!, and a visible TUI banner when the flag is enabled.boolthrough every network client —DeepSeekClient,McpPool,WebhookHookSink,OpenSandboxBackend, all skill-install/sync paths, the self-updater, and each individual web/search/fetch tool.last_composer_areaandlast_composer_contentpointing at the preview strip rather than the composer, breaking composer mouse hit-testing unconditionally after this change.Confidence Score: 4/5
Safe to merge after fixing the chunk-index off-by-one in ui.rs; the TLS plumbing itself is correct across all network paths.
The layout change in render() inserts a banner chunk at index 1 and correctly re-indexes most downstream accesses, but app.viewport.last_composer_area and the area variable in the block immediately below are still set to chunks[3] (now the preview strip) instead of chunks[4] (the composer). last_composer_area drives mouse hit-testing in mouse_ui.rs, so composer click and drag events will be routed incorrectly whenever a pending-input preview is visible — this is a present, reproducible defect introduced by this PR.
crates/tui/src/tui/ui.rs — the two chunks[3] references immediately after the composer render block need to become chunks[4].
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Config File\ninsecure_skip_tls_verify"] --> R B["Env Var\nDEEPSEEK_INSECURE_SKIP_TLS_VERIFY"] --> R R["resolve_insecure_skip_tls_verify()\nenv var wins, then config, default false"] R --> E["EngineConfig\n.insecure_skip_tls_verify"] R --> C["DeepSeekClient\nbuild_http_client(skip)"] R --> M["McpPool\n.with_skip_tls_verify(skip)"] R --> W["WebhookHookSink::new(skip)"] R --> U["run_update(beta, skip)"] R --> S["OpenSandboxBackend::new(skip)"] R --> SK["skills/install\ncandidate_urls / fetch_registry / sync_one_skill"] E --> TC["ToolContext\n.insecure_skip_tls_verify"] TC --> FU["FetchUrlTool"] TC --> WS["WebSearchTool"] TC --> WR["WebRunTool"] TC --> FT["FinanceTool\n⚠ hardcoded false (prev comment)"] TC --> IA["ImageAnalyzeTool\n⚠ hardcoded false (prev comment)"]Reviews (3): Last reviewed commit: "fix: delegate parse_bool_env to codewhal..." | Re-trigger Greptile