Skip to content

Remote desktop bearer token is serializable and leaks via JSON.stringify #22

Closed

Description

@superman2003

Summary

RemoteDesktopTransport stores the remote bearer token in a TypeScript
private field. private is erased at compile time — the property is a normal
enumerable own property at runtime, so anything that serializes a transport
emits the token in plaintext.

Evidence

src/lib/transport/remoteDesktopTransport.ts:

export class RemoteDesktopTransport implements BackendTransport {
  private readonly token: string;

The repo already asserts this must not happen, in
src/lib/transport/remoteDesktopTransport.test.ts:

expect(JSON.stringify(windowA)).not.toContain('token-a');

That test fails on master:

AssertionError: expected '{"environment":"remote-desktop","prof…' not to contain 'token-a'
Received: {"environment":"remote-desktop","profileId":"profile-a",
           "baseUrl":"https://server-a.example","token":"token-a",
           "bridge":{},"destroyed":false}

Impact

Any code path that stringifies a transport — structured logging, telemetry, a
crash report, React devtools state, an error boundary that dumps context —
writes a live remote-access bearer token wherever that output lands.

Fix

Use a true private #token field, which does not exist as an own property at
runtime and therefore cannot be serialized. Included in #20.

Related: #21

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions