Skip to content

fix(rivetkit): keep internal error exposure behavior consistent#4661

Draft
NathanFlurry wants to merge 1 commit intobreak-up/stabilize-actor-db-testsfrom
break-up/keep-error-exposure-consistent
Draft

fix(rivetkit): keep internal error exposure behavior consistent#4661
NathanFlurry wants to merge 1 commit intobreak-up/stabilize-actor-db-testsfrom
break-up/keep-error-exposure-consistent

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

Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 14, 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 14, 2026

Code Review: fix(rivetkit): keep internal error exposure behavior consistent

Overview

This PR removes the NODE_ENV=development shortcut from getRequestExposeInternalError in two files, making RIVET_EXPOSE_ERRORS=1 the sole mechanism for exposing internal errors to clients. It also fixes a bug where the isolate sandbox unconditionally forwarded RIVET_EXPOSE_ERRORS=1 to child processes, now only forwarding the env var when explicitly set in the parent.


What the PR Does Well

  • Correct security fix. Unconditionally injecting RIVET_EXPOSE_ERRORS=1 into every isolate sandbox process was a real information-disclosure bug: internal error details would always leak to sandboxed actors regardless of operator intent. The new conditional spread is the right fix.
  • Consistent with the rest of the env-forwarding block. RIVETKIT_TEST_DOCKER_HELPER_URL forwarding immediately below already uses the same conditional-spread pattern, so this change brings RIVET_EXPOSE_ERRORS into line.
  • Docstring updated. The JSDoc on getRequestExposeInternalError is updated to match the new behavior.

Issues

1. Incomplete fix: old.ts still checks NODE_ENV=development

File: rivetkit-typescript/packages/rivetkit/src/actor/protocol/old.ts:303-304

This file was not updated, so the behavior is still inconsistent. In the legacy protocol path, internal errors are still exposed whenever NODE_ENV=development, even after this PR. If the goal is consistent behavior, this call site needs the same treatment.

2. Conditional spread copies the raw env value, not normalised "1"

getRequestExposeInternalError only returns true when the value is exactly "1". If an operator sets RIVET_EXPOSE_ERRORS=true (or any other truthy string), the value is forwarded into the sandbox but the check inside the sandbox evaluates to false. This could cause the parent and child processes to disagree on whether errors are exposed.

Consider normalising to "1" when forwarding: ...(process.env.RIVET_EXPOSE_ERRORS ? { RIVET_EXPOSE_ERRORS: "1" } : {})

3. Breaking change for local development workflows

Removing the NODE_ENV=development shortcut means developers who relied on automatic error detail exposure in local dev environments now need to explicitly set RIVET_EXPOSE_ERRORS=1. This is a reasonable tradeoff for security consistency, but the PR description does not document this as a behaviour change and no docs update is present.


Summary

Issue Severity
old.ts still has the NODE_ENV check, making the fix incomplete Medium
Raw env value forwarded to sandbox instead of normalised "1" Low
Breaking DX change not documented Low

The core security fix (removing the unconditional RIVET_EXPOSE_ERRORS=1 injection into the sandbox) is correct and well-structured. The main outstanding item before merging is updating old.ts to match, otherwise the stated goal of consistent behavior is not fully achieved.

@NathanFlurry NathanFlurry changed the base branch from break-up/stabilize-driver-lifecycle-tests to graphite-base/4661 April 15, 2026 02:40
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from 309ad25 to b090c6c Compare April 15, 2026 02:40
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4661 to break-up/stabilize-actor-db-tests April 15, 2026 02:41
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from b090c6c to ae2a18f Compare April 15, 2026 02:50
@NathanFlurry NathanFlurry force-pushed the break-up/stabilize-actor-db-tests branch from 9c1861c to 8a0be32 Compare April 15, 2026 02:50
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from ae2a18f to feb2f40 Compare April 15, 2026 06:55
@NathanFlurry NathanFlurry force-pushed the break-up/stabilize-actor-db-tests branch from 8a0be32 to f676d13 Compare April 15, 2026 06:55
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