Skip to content

fix: harden shell-history privacy and enhance CLI type safety - #23

Open
mertcano wants to merge 1 commit into
context-labs:mainfrom
mertcano:mertcano-patch-1
Open

fix: harden shell-history privacy and enhance CLI type safety#23
mertcano wants to merge 1 commit into
context-labs:mainfrom
mertcano:mertcano-patch-1

Conversation

@mertcano

Copy link
Copy Markdown

Description

This PR addresses data privacy and code cleanliness findings within the uwu CLI repository. It implements defense-in-depth credential redaction for the opt-in shell history feature and replaces unsafe type suppressions with strict type boundaries.

Key Changes

  • Shell History Privacy (context.ts, README.md):
    • The opt-in shell history feature now strictly bounds the requested command history to a maximum of 50 lines to prevent excessive prompt contributions[cite: 40, 41].
    • Implemented proactive redaction that scrubs common secrets, including assignments, secret flags, bearer tokens, recognized provider token formats, and complete PEM private-key blocks, replacing them with redaction markers before transmitting data to the model provider[cite: 40, 41].
  • Documentation & Trust Limits (README.md):
    • Updated the documentation to explicitly clarify that history redaction is a defense-in-depth measure, not an absolute guarantee against application-specific secret leakage[cite: 40, 41].
    • Emphasized that users must review the generated commands before they are executed via eval[cite: 40, 41].
  • Type Safety & Error Handling (index.ts):
    • Replaced the unsafe @ts-ignore directive in the Anthropic response path by explicitly narrowing the content block discriminant (type === "text")[cite: 40].
    • Removed any types from the clipboard and top-level error handlers, replacing them with safe unknown parsing and explicit formatting helpers[cite: 40].

Validation & Testing

  • Focused Regression (context.test.ts): Verified 5 focused cases covering count normalization, secret flags, and multi-line PEM blocks, which all passed successfully[cite: 40].
  • Reviewer Action Required: The full CLI module build (bun build) and end-to-end type check are currently blocked by local dependency (https-proxy-agent / debug) resolution issues[cite: 40]. A maintainer must install dependencies in an authorized environment and run a strict TypeScript check before merging[cite: 40].

### Description
This PR addresses data privacy and code cleanliness findings within the `uwu` CLI repository. It implements defense-in-depth credential redaction for the opt-in shell history feature and replaces unsafe type suppressions with strict type boundaries.

### Key Changes
* **Shell History Privacy (`context.ts`, `README.md`):** 
  - The opt-in shell history feature now strictly bounds the requested command history to a maximum of 50 lines to prevent excessive prompt contributions[cite: 40, 41].
  - Implemented proactive redaction that scrubs common secrets, including assignments, secret flags, bearer tokens, recognized provider token formats, and complete PEM private-key blocks, replacing them with redaction markers before transmitting data to the model provider[cite: 40, 41].
* **Documentation & Trust Limits (`README.md`):** 
  - Updated the documentation to explicitly clarify that history redaction is a defense-in-depth measure, not an absolute guarantee against application-specific secret leakage[cite: 40, 41].
  - Emphasized that users must review the generated commands before they are executed via `eval`[cite: 40, 41].
* **Type Safety & Error Handling (`index.ts`):** 
  - Replaced the unsafe `@ts-ignore` directive in the Anthropic response path by explicitly narrowing the content block discriminant (`type === "text"`)[cite: 40].
  - Removed `any` types from the clipboard and top-level error handlers, replacing them with safe `unknown` parsing and explicit formatting helpers[cite: 40].

### Validation & Testing
* **Focused Regression (`context.test.ts`):** Verified 5 focused cases covering count normalization, secret flags, and multi-line PEM blocks, which all passed successfully[cite: 40].
* **Reviewer Action Required:** The full CLI module build (`bun build`) and end-to-end type check are currently blocked by local dependency (`https-proxy-agent / debug`) resolution issues[cite: 40]. A maintainer must install dependencies in an authorized environment and run a strict TypeScript check before merging[cite: 40].
@cursor

cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

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