Skip to content

fix: redact access key in public command accessor and inspect (CWE-312) - #47

Merged
07souravkunda merged 1 commit into
release_1.5.1from
locsec/WI-a20414f5
Sep 24, 2026
Merged

07souravkunda merged 1 commit into
release_1.5.1from
locsec/WI-a20414f5

Conversation

@07souravkunda

Copy link
Copy Markdown
Collaborator

What

The public command method returned the start-command string with the BrowserStack access key interpolated verbatim. Any consumer that logs bs.command for debugging — CI output, test-runner logs, or an APM / error tracker (Sentry, Datadog, Rollbar) — writes the credential into a sink that is often readable by a wider audience than the key itself (CWE-312: cleartext exposure of sensitive information). Ruby's default #inspect had the same problem: logging a Local instance, or including it in an exception payload, dumped @key.

Changes

  • command now returns the command with the key masked as [REDACTED].
  • start_command takes an optional redact flag (default false); the execution path (the start_command_args array used on all modern Ruby, and the legacy string form) keeps the real key, so the tunnel is unaffected.
  • Added a redacting #inspect so the access key is never dumped by default object inspection.
  • Proxy password is intentionally left visible (existing behaviour and unit test).
  • Added regression tests that fail on the pre-fix code and pass on the fix.

Verification

  • Before/after: command and inspect show [REDACTED] on the fix vs the key verbatim before.
  • start_command (execution path) still carries the real key.
  • Real tunnel started through the gem with a live key: start connected (isRunning=true), stop clean, no dangling process.
  • Unit suite: 23 runs, 50 assertions, 0 failures.

The public `command` method returned the start command string with the
BrowserStack access key interpolated verbatim, so any caller that logged
it (CI output, test runner logs, APM/error trackers) leaked the credential
to a wider audience than the key itself. Ruby's default #inspect had the
same problem, dumping @key when a Local instance was logged or raised.

- command now returns the command with the key masked as [REDACTED]
- start_command takes an optional redact flag; the execution path
  (start_command_args array, and the string form on legacy Ruby) keeps
  the real key, so the tunnel is unaffected
- add a redacting #inspect so the key is never dumped by object inspection

Proxy password is intentionally left visible (existing behaviour/tests).
Adds regression tests that fail on the pre-fix code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@07souravkunda 07souravkunda self-assigned this Sep 21, 2026
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d484c36e-1700-4ca1-b765-4884bbcfd2f7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@07souravkunda
07souravkunda marked this pull request as ready for review September 22, 2026 08:44
@07souravkunda
07souravkunda requested a review from a team as a code owner September 22, 2026 08:44
@07souravkunda
07souravkunda changed the base branch from master to release_1.5.1 September 24, 2026 10:34
@07souravkunda
07souravkunda merged commit 32f5f4f into release_1.5.1 Sep 24, 2026
6 checks passed
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.

2 participants