feat(core): introduce Client::gov_mode() with URL-host inference#1147
feat(core): introduce Client::gov_mode() with URL-host inference#1147addisonbeck wants to merge 1 commit into
Conversation
🔍 SDK Breaking Change DetectionSDK Version:
Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1147 +/- ##
==========================================
- Coverage 85.09% 85.09% -0.01%
==========================================
Files 464 465 +1
Lines 63866 63917 +51
==========================================
+ Hits 54348 54390 +42
- Misses 9518 9527 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
didn't get this quite ready before signing off for the weekend, sorry for the ping. Please ignore! |
Expose Client::gov_mode() on bitwarden_core::Client so SDK consumers (Key Management, Mobile, and TypeScript clients via WASM bindings) can detect Gov environments without rebuilding URL inference locally. The classifier infers Gov from the configured API URL host (bitwarden-gov.com or a subdomain) using url::Url parsing rather than substring matching, so spoofed subdomains (e.g. api.bitwarden-gov.com.evil.example) and path-only matches do not classify as Gov. Exposed via UniFFI for Swift/Kotlin and WASM for TypeScript through the existing wrapper layers. PM-36520 is the planned fast-follow that replaces URL inference with a /api/config server-published cloud_region read; the Client::gov_mode() signature is unchanged across that migration. Refs: PM-38266
3d03906 to
098a8e9
Compare
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the introduction of Code Review DetailsNo findings. The implementation is correct, the security-sensitive subdomain-spoofing edge cases are explicitly handled and tested, the bindings follow existing patterns, and the known self-hosted limitation is documented and deferred to PM-36520. |



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-38266
📔 Objective
Expose Client::gov_mode() on bitwarden_core::Client so SDK consumers can detect Gov environments without rebuilding URL inference locally.
Later on PM-36520 we'll replaces URL inference with a some sort of /api/config gov_mode read. After that isGovMode on clients will be updated to call the SDK.