Skip to content

Keep cloud bearer credentials out of command-line arguments #1902

Closed

Description

@phernandez

Problem

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.

Activity

  1. added
    security
    on Oct 28, 2026
  2. claude commented on Oct 28, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 23s —— View job


    Triage

    • Type: Enhancement (security hardening)
    • 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.

    No implementation was done, per the triage scope.

  3. added
    cloud
    enhancement
    on Oct 28, 2026
  4. added
    low-priority
    on Oct 28, 2026
  5. added this to the v1.0 milestone on Oct 29, 2026
  6. added a commit that references this issue on Oct 29, 2026
    fd732be
  7. added a commit that references this issue on Oct 29, 2026
    e77947e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cloudenhancementlow-prioritysecurity

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions