Skip to content

feat(desktop): add per-connection CA trust - #2964

Open
jackie-cqz wants to merge 4 commits into
oceanbase:masterfrom
jackie-cqz:feat/desktop-per-connection-ca
Open

jackie-cqz wants to merge 4 commits into
oceanbase:masterfrom
jackie-cqz:feat/desktop-per-connection-ca

Conversation

@jackie-cqz

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Refs #2918.

Rationale for this change

Users on managed workstations may need to connect Desktop to a Server whose HTTPS certificate is signed by a private CA. They can use a CA provided by their administrator even when they cannot add it to the operating system's trust store.

What changes are included in this PR?

  • Add a collapsed Advanced settings section to the new service dialog for HTTPS addresses. It sends the optional PEM to the existing native per-connection trust settings.
  • Show malformed PEM errors at the field and report certificate or hostname failures from the connection check. Keep the certificate input available for retry.
  • Add renderer regressions for the HTTPS flow, validation feedback, and switching back to loopback HTTP. Update the English and Chinese Desktop guides.

Are there any user-facing changes?

The new connection dialog labels the field in English and Chinese. An empty field uses the system trust store. Desktop continues to verify the hostname and uses a supplied CA only for that connection.

How was this change tested?

Local validation on macOS Apple Silicon at a80ca8e7, based on upstream 667f77e8.

  • Desktop pnpm test passed 88 renderer tests with mocked IPC and eight OpenAPI generator bootstrap tests using Node 24.14.1 and pnpm 11.13.1.
  • Desktop oxlint ui scripts, Prettier, node scripts/generate.mjs --check, tsc --noEmit, and vite build passed.
  • cargo +1.95.0 test --offline --locked --manifest-path desktop/src-tauri/Cargo.toml --test tls passed with a loopback HTTPS fixture. It connected with the supplied CA and rejected a missing CA or a mismatched hostname.
  • uv run --locked --no-sync python desktop/tests/real_server.py passed all four modes using the native server_probe and a locally built wheel. The private-CA HTTPS mode exercised a running SQLite-backed PowerContext Server over loopback with bearer authentication and a path prefix.
  • uv run --locked prek run -a and git diff --check passed.

Installed Desktop UI validation remains pending.

AI usage statement

OpenAI Codex (GPT-6) implemented the change and regression tests, reviewed the diff, and ran the local checks.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a80ca8e. I found no confirmed correctness defect in the CA-input change. It reuses the existing per-connection trust contract and does not change database schema or IPC/API fields.

Merge validation remains incomplete: CI preflight was cancelled, desktop-validation was skipped, and the aggregate gates failed. Please obtain passing required checks on the current head and tested merge result, and complete the pending installed-Desktop HTTPS/CA flow before merging. My native TLS run was blocked by host GLib/WebKitGTK dependencies, so it does not independently confirm the reported real-Server acceptance. Renderer runs exceeded the normal 5-second timeout on this heavily loaded host; the two added CA cases passed with a diagnostic 30-second timeout, which is not a clean standard-suite result. The generator retry failure also reproduces with the base scripts.

This is a validation-gap comment, not a demonstrated code defect; withholding approval pending these checks.

@hidb4ai hidb4ai added the module:desktop Primary module: desktop app and platform integration label Dec 2, 2026

@knqiufan knqiufan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit 9fd8b4e7.

The per-connection CA trust contract and security boundaries look solid; no merge-blocking issues found. Two small non-blocking polish items are noted inline (recommended before merge if convenient, otherwise fine to follow up):

  • P3 (non-blocking): Check discovery.error and connectionIdentity.error in addition to liveness.error for TLS failures (Overview.tsx).
  • P3 (non-blocking): Bring invalid CA validation feedback into view after collapsing Advanced settings or scrolling up (Overview.tsx).

Comment on lines +894 to +899
if (!active.report.compatibilityVerified) {
const failure = active.report.liveness.error;
throw failure?.code === "tls"
? failure
: { code: "compatibility_unverified" };
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Surface TLS failures from discovery and connectionIdentity as well (non-blocking)

In native session.rs, compatibilityVerified is determined by discovery and connection_identity, whereas liveness is an independent HTTP request that does not gate compatibilityVerified. If discovery or connection_identity fails with code: "tls" while liveness succeeds (e.g. mixed edge TLS config or cert rotation), this branch discards the TLS error and asks the user to select a verified compatibility profile instead.

Required outcome: inspect [active.report.discovery?.error, active.report.connectionIdentity?.error, active.report.liveness.error] for a tls error before falling back to compatibility_unverified.

</DialogHeader>
<DialogBody>
{error != null && (
{error != null && !certificateError && (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Keep invalid CA feedback visible in the dialog viewport on rejection (non-blocking)

When an invalid PEM is submitted after collapsing Advanced settings (or after scrolling back to the top of the dialog) at the default 1280×800 window size, setAdvancedOpen(true) expands the section and !certificateError suppresses the top PageFeedback, leaving the field error below the scrollable DialogBody viewport with zero visible height.

Required outcome: scroll the CA field/error into view and focus the CA input when invalid_certificate is returned (or retain a visible summary in view).

@hireview001

Copy link
Copy Markdown
Collaborator

The affected modules are Desktop. @PsiACE, please coordinate follow-up. Desktop: @PsiACE @knqiufan. Please coordinate the review of the affected changes.

@knqiufan knqiufan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit 5a23f665. LGTM — both earlier feedback items are addressed, the per-connection CA trust boundary and error/retry flow look clean, and no blocking issues remain.

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:desktop Primary module: desktop app and platform integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants