Skip to content

fix(serve-status): validate goal_id to block path traversal in reward routes - #3138

Merged
huangruiteng merged 1 commit into
mainfrom
codex/security-serve-status-goal-id
Aug 12, 2026
Merged

fix(serve-status): validate goal_id to block path traversal in reward routes#3138
huangruiteng merged 1 commit into
mainfrom
codex/security-serve-status-goal-id

Conversation

@huangruiteng

Copy link
Copy Markdown
Owner

What

append_human_reward built the run-index path directly from a caller-supplied goal_id (runtime_root/goals/{goal_id}/runs/index.jsonl) with no validation. An unauthenticated serve-status request could therefore read arbitrary files or append to arbitrary existing JSONL files.

Change

  • New validate_goal_id() in loopx/feedback.py: rejects empty ids, path separators, .., and shell metacharacters (single-path-segment token).
  • append_human_reward validates first, before any filesystem access.
  • serve-status reward and configure-goal request parsers validate goal_id as defense in depth; invalid ids fail closed with HTTP 400.

Validation

  • tests/test_feedback_goal_id_validation.py: 16 tests (safe/rejected id matrix, append rejection before I/O, reward + configure-goal HTTP 400 integration) - all pass.
  • tests/capabilities/test_reward_memory_ingestion.py + tests/test_trajectory_hygiene.py pass (no regression).
  • py_compile clean.

Addresses GHSA-hfmf-6xvq-9jw6 (details kept private pending coordinated disclosure).

… routes

append_human_reward built the run-index path from a caller-supplied
goal_id with no validation, letting an unauthenticated serve-status
request read arbitrary files or append to arbitrary JSONL files. Add a
compact goal-id validator used by append_human_reward and by the reward
and configure-goal request parsers, failing closed with a 400 before any
filesystem access.

Addresses GHSA-hfmf-6xvq-9jw6.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

中文结论

精确评审头: 3138@64bda433f(codex/security-serve-status-goal-id)

goal_id 强制单路径段校验:append_human_reward 在 I/O 前拒绝穿越,serve-status reward/configure-goal 路由对非法 goal_id 返回 400。exact head 上 16 项新增测试(含 HTTP 集成)+ reward-memory/trajectory-hygiene 回归全部通过。CI pytest 变红为 main 基线问题,与本 PR 无关。

结论:APPROVE(author-owned,以评论记录)。

English Verdict

APPROVE — exact head 64bda433f. goal_id is validated as a single path segment before any I/O; reward and configure-goal routes fail closed with HTTP 400 on traversal attempts. 16 new tests and regression suites pass; CI pytest red is a confirmed baseline failure.

@huangruiteng
huangruiteng merged commit 1511064 into main Aug 12, 2026
4 of 5 checks passed
@huangruiteng
huangruiteng deleted the codex/security-serve-status-goal-id branch August 12, 2026 16:02
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.

1 participant