Skip to content

Proposal: Shell environment credential leak auditor #27074

@jinguanghai

Description

@jinguanghai

Problem

OpenCode's shell tool inherits the user's full environment, including API keys, tokens, and credentials. These can be accidentally leaked in logs, tool outputs, or error messages.

Proposed Solution

Add an optional shellAudit() function that detects and redacts 8 types of credential patterns from the shell environment before execution.

Evidence

  • Implementation: ~40 lines TypeScript
  • Tests: 6 cases covering all 8 patterns + 2 edge cases
  • Zero breaking changes, zero new dependencies
  • Tested on dev branch

Checklist

  • Not a duplicate
  • Read contributing guidelines

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions