Skip to content

feat: add secure file-based wallet secret inputs - #45

Merged
kassandraoftroy merged 1 commit into
kassandraoftroy:mainfrom
dmarzzz:feat/secure-secret-file-inputs
Sep 4, 2026
Merged

feat: add secure file-based wallet secret inputs#45
kassandraoftroy merged 1 commit into
kassandraoftroy:mainfrom
dmarzzz:feat/secure-secret-file-inputs

Conversation

@dmarzzz

@dmarzzz dmarzzz commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds explicit file-backed secret inputs for non-interactive and local automation use:

  • --password-file <path> everywhere --password is accepted
  • --mnemonic-file <path> for imported wallets
  • one shared, fail-closed secret-file reader

This keeps secrets out of process arguments without changing existing literal/path-overloaded --password behavior.

Security and compatibility

  • Opt-in only; existing interactive and --password flows remain compatible.
  • File and literal forms are mutually exclusive.
  • On POSIX, secret files must be regular, owned by the current user, mode 0400 or 0600, and not symlinks.
  • The reader uses O_NOFOLLOW | O_NONBLOCK, then validates the opened descriptor and its identity against the pre-open file metadata.
  • Empty, oversized, NUL-containing, and invalid multiline inputs fail without echoing contents or local paths.
  • A single trailing LF or CRLF is removed; other password whitespace is preserved.
  • File-backed inputs fail closed on Windows because this implementation cannot validate Windows ACL ownership/mode safely.

Verification

  • TypeScript typecheck
  • Full test suite: 299 tests across 112 suites (Node 22.23.2)
  • Production build
  • git diff --check
  • CLI coverage for create/import and existing-wallet unlock paths

Relates to #44.

@kassandraoftroy kassandraoftroy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@kassandraoftroy
kassandraoftroy merged commit 71a5d22 into kassandraoftroy:main Sep 4, 2026
1 check 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