Skip to content

fix(cli): prompt for cloud API key instead of requiring argv - #1938

Merged
phernandez merged 1 commit into
mainfrom
fix/1902-api-key-prompt
Oct 29, 2026
Merged

phernandez merged 1 commit into
mainfrom
fix/1902-api-key-prompt

Conversation

@phernandez

Copy link
Copy Markdown
Member

Why

bm cloud api-key save bmc_... required the key on the command line, which leaves it in shell history and visible to other local users through ps. Found by the CodeRabbit deep scan (K23). Fixes #1902.

What changed

  • The key argument is optional. When omitted, the command reads it from a prompt that does not echo input.
  • The positional form still works, so existing scripts are unaffected.
  • Docs (docs/cloud-cli.md, AGENTS.md) show the prompt form.

Verification

  • New tests/cli/test_cloud_api_key_save.py: the two prompt tests fail without the fix; the positional test passes before and after.
  • just fast-check: clean

Stacked on #1937.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T02:14:52.140470Z 79140cc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@phernandez
phernandez added this pull request to stack #1940 October 29, 2026 02:31
@phernandez
phernandez force-pushed the fix/1902-api-key-prompt branch from 79140cc to fd732be Compare October 29, 2026 02:33
Base automatically changed from fix/1895-constrained-project-json to main October 29, 2026 02:42
bm cloud api-key save required the bmc_ key as a positional argument,
which leaves it in shell history and visible to other local users via
ps. Make the argument optional and read the key from a hidden prompt
when it is omitted. The positional form keeps working.

Fixes #1902

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8
Signed-off-by: phernandez <[email protected]>
@phernandez
phernandez force-pushed the fix/1902-api-key-prompt branch from fd732be to 537648b Compare October 29, 2026 02:42
@phernandez
phernandez merged commit e77947e into main Oct 29, 2026
14 of 15 checks passed
@phernandez
phernandez deleted the fix/1902-api-key-prompt branch October 29, 2026 02:43
phernandez added a commit that referenced this pull request Oct 29, 2026
## Why

Two CodeRabbit deep-scan findings where uploaded or caller-supplied
input on hosted Cloud drives unbounded work:

- **#1899 (K19/C37):** project ZIP planning matches every archive file
against every ignore pattern from the archive's own
`.gitignore`/`.bmignore`. Neither count had a limit; only expanded bytes
did (100MB).
- **#1893 (K8):** Postgres boolean phrase parsing does a whole-query
string replacement per quoted phrase, and `SearchQuery.text` had no
length limit.

## What changed

- `MAX_PROJECT_ZIP_FILES = 20_000` and `MAX_PROJECT_ZIP_IGNORE_PATTERNS
= 500` (archive-authored patterns only; Basic Memory defaults don't
count). Both fail fast with `ProjectZipImportError`, the same way the
existing size cap does.
- `MAX_SEARCH_TEXT_CHARS = 4_000` on `SearchQuery.text`. The MCP search
tool assigns fields after construction, so the cap is enforced when the
API router validates the request body, locally and on Cloud. The
similar-notes probe is capped at 900 chars, well inside the limit.

I picked hard limits over the "aggregate work budget" the scan
suggested. They are simpler and fail with a clear message.

Measured ZIP planning time (one core):

| files | archive patterns | time |
|---|---|---|
| 20,000 | 500 | 17.4s |
| 20,000 | 50 | 3.9s |
| 2,000 | 500 | 1.7s |

## Verification

- New tests for the file cap, the pattern cap (defaults excluded), the
schema cap, and a 422 from `QUERY /v2/.../search/`. Each fails without
the fix.
- Related suites in full (importers, `tests/api/v2`, search schema and
MCP search tools, project management): 665 passed, 1 skipped.
- `just fast-check`: clean

Cloud picks up both caps through `build_project_zip_import_plan` and the
core search router after the next re-pin. No Cloud code change is
needed.

Stacked on #1938.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8

---------

Signed-off-by: phernandez <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

Keep cloud bearer credentials out of command-line arguments

1 participant