[BUG] The eval handshake falls back to $HOME when the account has no passwd entry
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 50/100
調査の方向性
The fallback is in _account_home() in the crewai_core eval_handshake module, and awaiting_dir() and run_awaited_by_evaluation() depend on it. The CLI copy is _awaiting_dir in crewai_cli.crew_run_tui. Run the reproduction script from the issue with the pwd lookup patched to raise KeyError, and confirm that the directory resolves through $HOME. Done means both helpers raise OSError when the account database has no entry, with no $HOME fallback, and the existing call sites treat that as no evaluation waiting.
索引モデルが issue の本文から書いたものです。
説明
Description
crewai_core.eval_handshake decides whether a run may upload its trace without asking, by looking for a token file in this user's crewAI data directory. Its module docstring promises that a project's .env cannot move that directory:
Nor can it move the directory: it is found from this account's home in the account database, never from
HOMEorXDG_DATA_HOME, which a.envcan set.
But _account_home does not hold that promise when the account database has no entry for the process's uid:
def _account_home() -> Path:
"""This account's home from the account database, never `$HOME`."""
if os.name == "posix":
with contextlib.suppress(ImportError, KeyError, OSError):
import pwd
return Path(pwd.getpwuid(os.getuid()).pw_dir)
return Path.home()
Path.home() is os.path.expanduser("~"), which reads $HOME on POSIX. Running an arbitrary uid that has no passwd entry is standard practice in containers (OpenShift, docker run --user 1001), and there pwd.getpwuid(...) raises KeyError, is suppressed, and _account_home() returns $HOME - exactly the variable a project's .env can set.
The CLI copy of the same logic, crewai_cli.crew_run_tui._awaiting_dir, has the same fallback (except (ImportError, KeyError, OSError): home = Path.home()).
Consequence: in such a container, a project whose .env carries HOME=<repo> plus CREWAI_EVAL_AWAITING_RUN=<32 hex>, with a checked-in file <repo>/.local/share/crewai/eval-awaiting/<32 hex>, makes run_awaited_by_evaluation() true for an ordinary crewai run. That flips should_enable_tracing to True before any consent check, so the run's trace is uploaded although nobody ran crewai eval and nobody approved tracing - the bypass the docstring says is impossible.
Steps to Reproduce
The relevant path can be exercised without a real container by simulating the three conditions (uid missing from the account database, POSIX branch, $HOME planted):
import os
import sys
import types
from pathlib import Path
from crewai_core import eval_handshake
fake_pwd = types.ModuleType("pwd")
fake_pwd.getpwuid = lambda uid: (_ for _ in ()).throw(KeyError(uid))
sys.modules["pwd"] = fake_pwd
eval_handshake.os.name = "posix"
eval_handshake.os.getuid = lambda: 4242
Path.home = classmethod(lambda cls: Path("<repo>")) # what $HOME would resolve to
os.environ["CREWAI_EVAL_AWAITING_RUN"] = "a" * 32
assert eval_handshake.awaiting_dir() == Path("<repo>/.local/share/crewai/eval-awaiting")
assert eval_handshake.run_awaited_by_evaluation() is True # with the planted file present
On a real POSIX container where pwd.getpwuid(os.getuid()) raises KeyError, HOME is read from the project's .env the same way, with no patching at all.
Expected Behavior
When the account database cannot name this account's home, the handshake should fail closed - report no trusted folder (for example raise OSError, which both call sites already handle as "no evaluation is waiting") instead of falling back to $HOME. The CLI's copy of _awaiting_dir should do the same, so crewai eval also never writes its token under a folder a .env chose.
AI assistance
I used an AI coding agent to investigate, reproduce, and prepare this report, and reviewed its results. Per CONTRIBUTING.md, please apply the llm-generated label; external contributors cannot add it with my current permissions.
- 主要言語
- Python
- スター
- 61.2k
- フォーク
- 9.2k
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 180
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM provider対応中かも @HashimSyedUBC が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missing対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native Azure provider ignores the seed setting対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
crewAIInc/crewAI#9787 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summary対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
bug harness
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mruangutai/harness#2687 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modal-labs/modal-client#4158 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
The-Swarm-Corporation/swarms-rs#168 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linuxserver/docker-healthchecks#137 · コメント 1 件 ·