Skip to content

chore: configure TLS trust roots for rustls clients#4667

Draft
NathanFlurry wants to merge 1 commit intorecover-engine-npm-packagefrom
04-14-configure_tls_trust_roots_for_rustls_clients
Draft

chore: configure TLS trust roots for rustls clients#4667
NathanFlurry wants to merge 1 commit intorecover-engine-npm-packagefrom
04-14-configure_tls_trust_roots_for_rustls_clients

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link
Copy Markdown

railway-app bot commented Apr 15, 2026

🚅 Deployed to the rivet-pr-4667 environment in rivet-frontend

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Apr 15, 2026 at 10:20 am
mcp-hub ✅ Success (View Logs) Web Apr 15, 2026 at 10:07 am
kitchen-sink ❌ Build Failed (View Logs) Web Apr 15, 2026 at 10:07 am
frontend-cloud 😴 Sleeping (View Logs) Web Apr 15, 2026 at 6:33 am
ladle ✅ Success (View Logs) Web Apr 15, 2026 at 6:26 am
frontend-inspector ❌ Build Failed (View Logs) Web Apr 15, 2026 at 6:22 am

@NathanFlurry NathanFlurry changed the title Configure TLS trust roots for rustls clients chore: configure TLS trust roots for rustls clients Apr 15, 2026
@NathanFlurry NathanFlurry marked this pull request as ready for review April 15, 2026 06:21
@NathanFlurry NathanFlurry marked this pull request as draft April 15, 2026 06:21
Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 15, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown

claude bot commented Apr 15, 2026

Code Review

Overview

This PR migrates rustls-based TLS clients (tokio-tungstenite, reqwest in rivetkit-rust) from native-tls/OpenSSL to a dual-roots strategy combining rustls-tls-native-roots and rustls-tls-webpki-roots. It also removes tokio-native-tls from the engine workspace, adds @rivetkit/rivetkit-native to the sandbox example, and contains a large reformatting of the generated engine-runner-protocol file.


TLS Strategy (Core Change)

The dual-roots approach is well-reasoned and correctly documented in CLAUDE.md:

  • native roots -- works for operator-installed corporate CAs
  • webpki roots -- fallback for Distroless/Alpine containers without ca-certificates

The CLAUDE.md note that engine-internal clients (ClickHouse, hyper-tls, guard HTTP proxy) intentionally stay on OpenSSL is a good explicit carve-out that prevents future confusion.

Security note: Enabling both root stores creates a union trust set -- any CA in either store is trusted. This is the correct trade-off for the stated use case, but it does slightly expand the trust surface compared to webpki-only. This appears intentional and acceptable.


Issues / Questions

1. Quinn unexpectedly pulled in as a reqwest dependency

In rivetkit-rust/Cargo.lock, quinn appears as a resolved dependency of reqwest (alongside quinn-proto, quinn-udp) even though the http3 feature is not listed in client/Cargo.toml. Quinn is normally only compiled when reqwest's http3 feature is enabled. This may be a transitive resolution from eventsource-client or a change in reqwest 0.12.28's feature graph. Please verify whether HTTP/3 is being inadvertently compiled in -- it adds non-trivial binary size and compile time.

2. default-features = false drops HTTP response compression

The previous reqwest config used default features, which include gzip, brotli, and deflate decompression. The new default-features = false config drops all of these. If the Rivet backend sends compressed responses, the client will silently receive compressed bytes it cannot decode. Please confirm this is intentional or add the relevant compression features back.

3. Large reformatting noise in a generated file

rivetkit-typescript/packages/engine-runner-protocol/src/index.ts is marked // @generated - post-processed by build.rs, but this PR changes roughly 2000 lines of indentation (tabs to spaces) and removes semicolons throughout. This mixes pure style churn into a functional change and makes the diff hard to review. Recommend separating into its own commit, or documenting why the generator output changed.

4. Sandbox example: Vercel equivalent not updated

Per CLAUDE.md, updating examples requires also updating the Vercel equivalent. The examples/sandbox/vite.config.ts and package.json changes do not have a corresponding Vercel example update. Either run ./scripts/vercel-examples/generate-vercel-examples.ts or confirm that Vercel does not apply to this example.


Minor Observations

  • Removal of rivetkit-typescript/packages/sqlite-vfs and sqlite-native from pnpm-lock is consistent with the CLAUDE.md native-only SQLite policy.
  • examples/global-smoke-test removal from pnpm-lock is unexplained in the PR description -- confirm this is intentional.
  • The CLAUDE.md note to "bump webpki-roots periodically" is good guidance; consider backing it with a Dependabot/Renovate rule so it does not rely on manual memory.
  • Multiple unrelated changes (TLS migration, protocol reformatting, workspace cleanup, sandbox example) are bundled in one PR. Fine for a draft, but worth splitting before merge.

Summary

The core TLS migration is solid and the CLAUDE.md documentation is clear and useful. The main items to resolve before merge: verify the unexpected Quinn dependency, confirm whether HTTP compression is still needed, and separate the generated file reformatting from the functional changes.

@claude
Copy link
Copy Markdown

claude bot commented Apr 15, 2026

PR Review: chore: configure TLS trust roots for rustls clients

Overview

This PR addresses TLS trust root configuration for rustls-based outbound TLS clients (tokio-tungstenite, reqwest) in the rivetkit-rust SDK. The core change enables both rustls-tls-native-roots and rustls-tls-webpki-roots together as a union trust store, fixing TLS failures in Distroless/minimal container images.

Substantive Changes

TLS Configuration (core fix)

  • Workspace tokio-tungstenite: adds rustls-tls-webpki-roots alongside rustls-tls-native-roots.
  • rivetkit-rust reqwest: switches from default features to default-features = false with explicit rustls features.
  • tokio-tungstenite in rivetkit-rust client: switches from native-tls to the dual rustls feature set.
  • CLAUDE.md documents the convention clearly and accurately.

remote_manager.rs client reuse
Caching reqwest::Client in RemoteManager instead of per-call creation is a good fix. Connection pools are per-client, avoiding repeated TCP/TLS handshake overhead.


Issues and Suggestions

1. Missing reqwest default features (potential regression)
Setting default-features = false silently drops gzip, deflate, brotli (automatic decompression), cookies, and socks. If Rivet API endpoints return compressed responses the Rust SDK will receive raw bytes. Consider explicitly adding gzip, deflate, brotli unless compression is intentionally disabled.

2. Removal of eventsource-client without replacement
eventsource-client was removed from rivetkit-rust/packages/client/Cargo.toml with no visible replacement. If the Rust client used SSE for actor events this drops that capability. Needs either a replacement transport or explicit acknowledgement that SSE is dropped.

3. Two webpki-roots versions in rivetkit-rust
The lock carries webpki-roots 0.26.11 (from tokio-tungstenite) and webpki-roots 1.0.6 (from reqwest/hyper-rustls). Not a bug, but the Mozilla CA bundle is duplicated in the binary. Worth tracking for consolidation once upstream aligns.

4. Generated file formatting churn in engine-runner-protocol
engine-runner-protocol/src/index.ts is fully reformatted from tabs to spaces (~2,500 lines of diff). Functionally a no-op for a generated file but makes git blame noisier. Please confirm this is an intentional codegen settings change and not accidental regeneration.

5. Silent removal of examples/global-smoke-test and sqlite-vfs
pnpm-lock.yaml removes these without any mention in the PR. global-smoke-test in particular sounds like a test harness worth confirming as intentionally dropped.

6. PR description is empty
Filling in the motivation (Distroless/Alpine failures, corporate CA compatibility) before un-drafting would help reviewers and future git log readers.


CLAUDE.md Alignment

  • New TLS section correctly documents the dual-root strategy and the engine-internal OpenSSL exception.
  • Note to periodically bump webpki-roots is good operational hygiene.
  • Entries use bullet points and avoid em dashes as required.

Summary

The core TLS fix is correct and well-reasoned. Main items to address before merge:

  1. Confirm or restore compression features (gzip/deflate/brotli) dropped by default-features = false on reqwest.
  2. Confirm eventsource-client removal is intentional.
  3. Confirm the engine-runner-protocol formatting change is intentional.
  4. Fill out the PR description before un-drafting.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Preview packages published to npm

Install with:

npm install rivetkit@pr-4667

All packages published as 0.0.0-pr.4667.da01c89 with tag pr-4667.

Engine binary is shipped via @rivetkit/engine-cli on linux-x64-musl, linux-arm64-musl, darwin-x64, and darwin-arm64. Windows users should use the release installer or set RIVET_ENGINE_BINARY.

Docker images:

docker pull rivetdev/engine:slim-da01c89
docker pull rivetdev/engine:full-da01c89
Individual packages
npm install rivetkit@pr-4667
npm install @rivetkit/react@pr-4667
npm install @rivetkit/rivetkit-native@pr-4667
npm install @rivetkit/workflow-engine@pr-4667

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.

1 participant