Skip to content

fix(cli): harden shell history privacy, credential input, and error redaction - #5

Open
magqqgq wants to merge 1 commit into
nadohq:mainfrom
magqqgq:magqqgq-patch-1
Open

magqqgq wants to merge 1 commit into
nadohq:mainfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Aug 27, 2026

Copy link
Copy Markdown

Description

This PR implements comprehensive security hardening for the CLI shell, credential management, and error handling flows. It prevents sensitive keys from leaking into command history, command-line arguments, or application error logs.

Key Changes

  • Shell History Privacy (shell.ts):
    • Added strict regex patterns (SENSITIVE_HISTORY_PATTERNS) to filter out sensitive commands (e.g., private-key configurations) from being persisted to disk.
    • Enforced restrictive file permissions (0o600) on history storage.
  • Credential Management (auth.ts):
    • Blocked passing private keys directly as command-line arguments to nado auth set, directing users to interactive or environment-variable workflows.
    • Hardened the 1-Click Trading setup wizard and link-signer operations.
  • Error Redaction (errors.ts, index.ts):
    • Introduced automatic secret redaction (redactSecrets) across all error handling pathways, scrubbing 32-byte hex strings (0x + 64 hex characters) from terminal error messages.
    • Ensured uncaught exceptions caught by the CLI root entrypoint pass through the redaction layer before printing to stderr.

Validation & Testing

  • Invariants: Verified shell filtering, file permissions, and error redaction rules match workspace security requirements.

…edaction

### Description
This PR implements comprehensive security hardening for the CLI shell, credential management, and error handling flows. It prevents sensitive keys from leaking into command history, command-line arguments, or application error logs.

### Key Changes
* **Shell History Privacy (`shell.ts`):** 
  - Added strict regex patterns (`SENSITIVE_HISTORY_PATTERNS`) to filter out sensitive commands (e.g., private-key configurations) from being persisted to disk.
  - Enforced restrictive file permissions (`0o600`) on history storage.
* **Credential Management (`auth.ts`):** 
  - Blocked passing private keys directly as command-line arguments to `nado auth set`, directing users to interactive or environment-variable workflows.
  - Hardened the 1-Click Trading setup wizard and link-signer operations.
* **Error Redaction (`errors.ts`, `index.ts`):** 
  - Introduced automatic secret redaction (`redactSecrets`) across all error handling pathways, scrubbing 32-byte hex strings (`0x` + 64 hex characters) from terminal error messages.
  - Ensured uncaught exceptions caught by the CLI root entrypoint pass through the redaction layer before printing to `stderr`.

### Validation & Testing
* **Invariants:** Verified shell filtering, file permissions, and error redaction rules match workspace security requirements.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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