You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep cloud bearer credentials out of command-line arguments #1902
cloudBasic Memory CloudenhancementNew feature or requestlow-priorityDeferred lower-priority work; retained for follow-upsecuritySecurity hardening and vulnerability fixes
Follow-up from the reviewed CodeRabbit deep scan (K23). This ticket tracks one distinct fix; duplicate scan rows are consolidated here.
Reviewed evidence and scope
K23 (scan ID d94b522d-10dd-4608-9f2c-d439269085e3, review A, Low): Bearer passed in CLI argv is observable on some shared hosts. Offer prompt/stdin/environment input; do not treat as remote service exposure.
Source at current baseline: src/basic_memory/cli/commands/cloud/core_commands.py:331.
Fix and validation
Keep cloud bearer credentials out of command-line arguments.
Recheck current callers and supported behavior before choosing the smallest complete fix.
Add a bounded regression at the affected public or service boundary; demonstrate it fails without the fix.
Preserve legitimate inputs and tenant/project boundaries. Run focused tests plus repository static/type checks.
The scan/review establishes the code-level concern described above; it does not establish production exploitation. Conditional branches and local/tooling-only exposure must retain that scope.
Priority: Low. This is local exposure only: a bearer key in argv can be seen by other users on a shared host through process listings or shell history. It is not remote exposure.
Component: CLI, cloud functionality
Complexity: Simple
Duplicates: I searched open and closed issues and found none.
Findings
The argument is real. bm cloud api-key save <key> takes the key as a required positional typer.Argument at src/basic_memory/cli/commands/cloud/core_commands.py:329-349. The docstring example bm cloud api-key save bmc_abc123... shows it passed on the command line. I did not check other commands for similar arguments.
Suggested approach (for whoever picks this up)
Make the api_key argument optional. When it's omitted, read the key from a hidden prompt (typer.prompt(..., hide_input=True)) or from stdin when stdin is not a TTY. An environment variable would also work.
Decide whether to keep the positional form. Removing it would break existing scripts. A deprecation warning that points to the safer input paths may be the smallest complete fix.
Keep the bmc_ prefix validation and the existing persist_env_keys behavior unchanged.
Update the docs and docstring examples, and the README, skills, and plugin docs if they show the positional form.
Add regression tests with CliRunner that feed the key through input and assert it never needs to appear in args.
cloudBasic Memory CloudenhancementNew feature or requestlow-priorityDeferred lower-priority work; retained for follow-upsecuritySecurity hardening and vulnerability fixes
Activity
claude commentedon Oct 28, 2026
Claude finished @phernandez's task in 23s —— View job
Triage
Findings
The argument is real.
bm cloud api-key save <key>takes the key as a required positionaltyper.Argumentatsrc/basic_memory/cli/commands/cloud/core_commands.py:329-349. The docstring examplebm cloud api-key save bmc_abc123...shows it passed on the command line. I did not check other commands for similar arguments.Suggested approach (for whoever picks this up)
api_keyargument optional. When it's omitted, read the key from a hidden prompt (typer.prompt(..., hide_input=True)) or from stdin when stdin is not a TTY. An environment variable would also work.bmc_prefix validation and the existingpersist_env_keysbehavior unchanged.CliRunnerthat feed the key through input and assert it never needs to appear inargs.No implementation was done, per the triage scope.
fix(cli): prompt for cloud API key instead of requiring argv
fix(cli): prompt for cloud API key instead of requiring argv (#1938)