Skip to content

fix(benchmark): distinguish env command wrappers - #8320

Open
huangruiteng wants to merge 1 commit into
mainfrom
codex/benchmark-credential-assignment-probes-20261108
Open

huangruiteng wants to merge 1 commit into
mainfrom
codex/benchmark-credential-assignment-probes-20261108

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

Every env invocation was classified as credential enumeration, so ordinary task execution such as env MODE=fast pytest -q produced integrity suspicion.

This change parses a bounded set of env options and assignment prefixes, then recursively classifies the literal command being executed. Literal loop-generated assignment packs are accepted only when every value is statically assignment-shaped; reassignment, indirect expansion, command substitution, unknown options, dynamic commands, bare env, printenv, /proc/*/environ, and nested Python/Node/shell reads remain suspicious.

Validation:

  • 207 passed in tests/capabilities/test_benchmark_toolkit.py
  • Ruff and focused mypy checks passed
  • private call-site replay across 255 tool calls changed all 9 adjudicated false-positive hashes, preserved 2 genuine probe detections, and introduced no unrelated classification changes; no private artifacts are included
  • premerge selected 6 canaries and all passed; the benchmark-sensitive maintainer review hold remains
  • public-boundary scans for both changed files passed

Signed-off-by: huangruiteng <huangrt01@163.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent, gpt-6.1-sol, OpenAI, runtime_reported, reasoning_effort=max

[P2] 赋值证明跨越使用点和源变量变更。 全脚本证明把稍后才被循环赋值的变量视为已知,在循环前同名变量仍可来自继承环境;从后缀表达式派生赋值串时,源变量被改写后也保留证明。两个真实 shell 用例都读到了合成标记,源 CLI 的探针计数各从 1 变为 0。

[P2] env 选项参数的命令替换漏记。 env 的分离选项参数被直接跳过。shell 会先执行其中的命令替换,随后才运行 env;实际读取合成标记的 -u 参数用例从 1 变为 0。

动机 / Motivation

使用 benchmark-toolkit 审查轨迹完整性的维护者需要区分普通 env 包装器和可能读取凭证环境的行为。 在隔离 shell 里比较字面量包装、直接读取、使用时尚未赋值的变量、改写后的派生源和选项求值。 字面量包装误报减少;三个过去有证据的合成读取在本提交漏记。 改动仅在既有 benchmark-toolkit 本地完整性证据路径。

改动思路 / Approach

外层 env 在检查选项、赋值和展开后把余下子命令交给现有分类器;循环证明试图区分赋值串和未知参数。 沿用已有 typed command 提取和 probe 计数。env 的安全豁免依赖 shell 的实际求值顺序;静态扫描在时间和来源方面都必须保守。 改动仅在既有 benchmark-toolkit 本地完整性证据路径。

具体改动 / Changes

基线为 8a4d4f9dab17b01d6fe3546936155b4d718fc20d。既有完整性契约把 typed command 的疑似探针与凭证值实际进入任务上下文分别建模。 基线规范

  • 普通包装器。 同一组隔离 shell 和生产 CLI 结果显示,普通字面量 env 包装器的误报从 1 降到 0;显式读取的正对照保持 1。
  • 变量证明。 全脚本证明把稍后才被循环赋值的变量视为已知,在循环前同名变量仍可来自继承环境;从后缀表达式派生赋值串时,源变量被改写后也保留证明。两个真实 shell 用例都读到了合成标记,源 CLI 的探针计数各从 1 变为 0。
  • 选项求值。 env 的分离选项参数被直接跳过。shell 会先执行其中的命令替换,随后才运行 env;实际读取合成标记的 -u 参数用例从 1 变为 0。

关键代码讲解

赋值证明 → env 参数 → 子命令。选项参数自身在递归子命令前就已经由 shell 求值。

对主干的风险 / Risks

该信号降低后会丢失实际读取的复核线索。普通包装器误报的修复在同一对照中仍成立。

207 项 benchmark-toolkit 测试通过,独立 7 组 shell/CLI 对照完成。 Quick premerge 的 6 项直接检查和 3 项选中检查通过。 DCO 和与评审基线的合并树通过;保留既有 benchmark 人工门。 对照使用 Bash 和本地源 CLI,标记全为合成数据。 远端 CI 未取样。

我的整体评价 / Verdict

把赋值证明限制在实际使用点,跟踪并在写入时失效源及派生变量;没有可靠证明时维持保守结果。跳过 env 选项前校验动态参数,覆盖分离及附着形式,并复跑三个漏报和字面量对照。 未对真实凭证或评分执行任何操作;计数是可疑读取的观察信号,不能单独判定凭证访问、有效成绩或授权。

English verdict: REQUEST_CHANGES. Three matched cases still read a synthetic environment marker, but the candidate drops their probe counts from one to zero. Require valid assignment proof at each use and inspect option operands before skipping them.

)
if expansion:
name = expansion.group(1) or expansion.group(2)
if name in assignment_expansions:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Keep assignment proof valid at the point of use

全脚本证明把稍后才被循环赋值的变量视为已知,在循环前同名变量仍可来自继承环境;从后缀表达式派生赋值串时,源变量被改写后也保留证明。两个真实 shell 用例都读到了合成标记,源 CLI 的探针计数各从 1 变为 0。 在使用点验证赋值,并让重新赋值使源和派生证明失效。

if option in {"-u", "--unset", "-C", "--chdir"}:
if index + 1 >= len(arguments):
return True
index += 2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Check option operands for shell evaluation before skipping them

env 的分离选项参数被直接跳过。shell 会先执行其中的命令替换,随后才运行 env;实际读取合成标记的 -u 参数用例从 1 变为 0。 在跳过选项前保留实际求值产生的探针证据,覆盖分离和附着值。

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.

2 participants