Skip to content

Exit non-zero on tool CLI failures - #9770

Open
Wooohaaa wants to merge 1 commit into
crewAIInc:mainfrom
Wooohaaa:fix/tool-cli-exit-codes
Open

Wooohaaa wants to merge 1 commit into
crewAIInc:mainfrom
Wooohaaa:fix/tool-cli-exit-codes

Conversation

@Wooohaaa

Copy link
Copy Markdown

Fixes #9763.

Several tool create/install/login failure paths raised a bare SystemExit, whose code None is reported as exit status 0, so scripts and CI saw success after a failed command.

Uses SystemExit(1) consistently, matching the other failure paths in the same module. Strengthens two tests to assert code 1.

Several tool create/install/login failure paths raised a bare SystemExit,
whose code None is reported as exit status 0, so scripts and CI saw success
after a failed command. Use SystemExit(1) consistently, matching the other
failure paths in the same module. Strengthen two tests to assert code 1.

Fixes crewAIInc#9763
@strix-security

strix-security Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Strix Security Review

✅ No open security findings.

PR summary: The CLI's tool create/install/login failure paths raised a bare `SystemExit`, whose `None` code exits 0, so CI and scripts saw success after a failed command. This PR raises `SystemExit(1)` on those paths and strengthens two tests to assert the non-zero code.

Review summary

The diff only converts seven bare raise SystemExit statements into raise SystemExit(1) across ToolCommand's failure branches (existing folder, unsynced repo, 404/5xx install, non-200 login, uv add stderr, in-project guard) and tightens two tests to assert exit code 1. No data flow, validation, authorization or credential handling changes: the modified lines report process status only.

Because several of those branches sit inside methods that build the tool-install/uv build argv and persist the tool-repository login, those method bodies were traced in full. Every suspicion raised there turned out to be pre-existing code this PR neither adds nor re-routes (settings-file fallback locations, CREWAI_PLUS_URL base-URL resolution, credential export to project-declared index names, and registry-supplied uv add arguments), so nothing in the change is a vulnerability.

Ruled out (4)
  • Can a settings file planted at the world-writable temporary-directory fallback path redirect the tool-repository login and capture the user's tokens?
    That path selection and the unchecked read of an existing settings file live entirely in `crewai_core/settings.py`, which the PR does not touch, and the credential-writing success path in `login()` is byte-identical before and after the change.
  • Can the registry-supplied tool handle or index URL inject options or a direct URL into the `uv add` invocation?
    The `uv add` argv construction is unchanged pre-existing code, the response comes from the authenticated first-party registry, and the edited `stderr` branch it sits next to is dead because `capture_output=False` makes `stderr` `None`.
  • Can a project-supplied `CREWAI_PLUS_URL` make the CLI send the saved bearer token to an attacker host?
    The environment-derived base URL and the `Authorization` header are built in `plus_api.py`, untouched by this PR, and the tool commands whose error branches were edited never load a project `.env`, so the token-leak path runs through `crewai run` tracing/deploy instead.
  • Are the stored tool-repository credentials exported to an index name controlled by a cloned project's `pyproject.toml`?
    The credential-export helpers and the `[tool.uv.sources]` loops are byte-identical at the base commit, and the PR adds no caller, route or input that reaches them.

Review 1 on this PR · a205291 · requested Nov 25 07:39 UTC when the PR was opened


Reviewed by Strix
Re-run review · Configure security review settings · Try a deeper review with @strix-security /deep

This branch has not been deployed

No deployments
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.

[BUG] crewai tool create/install/login exit 0 when they fail

1 participant