Skip to content

fix: exclude password commands from interactive history - #251

Open
Bewear777 wants to merge 7 commits into
vesoft-inc:masterfrom
Bewear777:fix/skip-password-history
Open

Bewear777 wants to merge 7 commits into
vesoft-inc:masterfrom
Bewear777:fix/skip-password-history

Conversation

@Bewear777

@Bewear777 Bewear777 commented Oct 19, 2026 •

Copy link
Copy Markdown

What type of PR is this?

  • [] bug
  • feature
  • [x ] enhancement
  • documentation

What problem(s) does this PR solve?

Issue(s) number:

Fixes #257

Description:

NebulaGraph Console can append interactive commands containing passwords to the local .nebula_history file.

As a result, sensitive information may be exposed through the local command history.

How do you solve it?

  • Add an isCmdWithPassword() helper in cli/icli.go to detect password or pwd using case-insensitive matching.
  • Check the completed command in iCli.ReadLine() before calling AppendHistory().
  • Skip appending matching commands while still returning them for normal execution.
  • Check multiline commands after they have been assembled.

Tests

Add unit tests in cli/icli_test.go covering:

  • Case-insensitive matching of password.
  • Matching of pwd.
  • Ordinary commands that do not contain either keyword.
  • Password commands being skipped by ReadLine().
  • Ordinary commands still being appended to history.
  • Multiline password commands being checked after assembly.

Run the tests with:

go test ./cli

Special notes for your reviewer, ex. impact of this fix, design document, etc:

  • Scope: This change prevents matching commands from being appended to the Liner-backed history that is persisted in the local .nebula_history file.
  • GoPrompt limitation: This PR does not filter GoPrompt's internal in-memory history. GoPrompt records input internally before Prompt() returns it to ReadLine(); this PR does not change that behavior.
  • Existing command execution behavior remains unchanged.
  • Matching is case-insensitive and uses substring matching. Ordinary commands containing password or pwd as substrings may also be skipped.
  • This change does not remove sensitive commands already present in an existing .nebula_history file.
  • No public API changes.

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.

Avoid storing password-related commands in interactive history

1 participant