Skip to content

fix(gateway): add GATEWAY_SKIP_VERIFY_HOSTS for selective TLS skip#145

Merged
guyb1 merged 4 commits intoonecli:mainfrom
mbravorus:feat/per-host-tls-skip-verify
Apr 3, 2026
Merged

fix(gateway): add GATEWAY_SKIP_VERIFY_HOSTS for selective TLS skip#145
guyb1 merged 4 commits intoonecli:mainfrom
mbravorus:feat/per-host-tls-skip-verify

Conversation

@mbravorus
Copy link
Copy Markdown
Contributor

Summary

  • Adds GATEWAY_SKIP_VERIFY_HOSTS env var to the gateway: a comma-separated list of hostname patterns for which TLS certificate validation is skipped on upstream connections
  • Complements the existing all-or-nothing GATEWAY_DANGER_ACCEPT_INVALID_CERTS flag with host-selective control — no DB or schema changes required
  • Pattern syntax: exact match (internal.corp) or wildcard subdomain prefix (*.internal.corp); matching is case-insensitive
  • Implementation builds a second reqwest::Client (no-verify) at startup and selects between strict/no-verify per CONNECT request based on hostname match

Test plan

  • cargo test — 132 unit tests + 5 integration tests all pass (including 6 new tests covering exact match, wildcard, case-insensitivity, empty list, and env var parsing)
  • cargo clippy -- -D warnings — clean
  • cargo fmt --check — clean
  • Set GATEWAY_SKIP_VERIFY_HOSTS=*.internal.corp and verify gateway logs "TLS verification skipped" only for matched hosts
  • Verify unmatched hosts still use strict TLS

Notes

pnpm build and pnpm check surface two pre-existing failures unrelated to this PR:

  • apps/web: implicit any on filter callback in manage-access-dialog.tsx:89
  • packages/db: missing Prisma generated client exports (User, ConnectedService, AuditLog) — requires pnpm db:generate against a live DB

🤖 Generated with Claude Code

Extends the existing `GATEWAY_DANGER_ACCEPT_INVALID_CERTS` global flag
with a finer-grained alternative: `GATEWAY_SKIP_VERIFY_HOSTS` accepts a
comma-separated list of hostname patterns and disables TLS certificate
validation only for matched upstream hosts.

Pattern syntax:
- Exact match: `internal.corp`
- Wildcard subdomain: `*.internal.corp` (matches apex and all subdomains)
- Matching is case-insensitive

Implementation holds two reqwest::Client instances (strict / no-verify)
and selects between them per CONNECT request. No DB or schema changes.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@mbravorus
Copy link
Copy Markdown
Contributor Author

this is not technically a new feature, rather an enhancement for the existing all-or-nothing env variable toggle for skipping cert verification, done with another env variable hosting a whitelist, so minimum complexity, and no need to keep an extra reqwest if nothing matches

@guyb1 guyb1 changed the title feat(gateway): add GATEWAY_SKIP_VERIFY_HOSTS for selective TLS skip fix(gateway): add GATEWAY_SKIP_VERIFY_HOSTS for selective TLS skip Apr 3, 2026
@guyb1 guyb1 merged commit 962d948 into onecli:main Apr 3, 2026
1 check passed
@guyb1 guyb1 mentioned this pull request Apr 3, 2026
hisgarden pushed a commit to hisgarden/onecli that referenced this pull request Apr 11, 2026
…necli#145)

* feat(gateway): add GATEWAY_SKIP_VERIFY_HOSTS for per-host TLS skip

Extends the existing `GATEWAY_DANGER_ACCEPT_INVALID_CERTS` global flag
with a finer-grained alternative: `GATEWAY_SKIP_VERIFY_HOSTS` accepts a
comma-separated list of hostname patterns and disables TLS certificate
validation only for matched upstream hosts.

Pattern syntax:
- Exact match: `internal.corp`
- Wildcard subdomain: `*.internal.corp` (matches apex and all subdomains)
- Matching is case-insensitive

Implementation holds two reqwest::Client instances (strict / no-verify)
and selects between them per CONNECT request. No DB or schema changes.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* some fixes

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Guy Ben Aharon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants