Skip to content

fix(security): 2 improvements across 2 files#836

Open
tomaioo wants to merge 2 commits intoalibaba:masterfrom
tomaioo:fix/security/path-traversal-allows-arbitrary-file-wri
Open

fix(security): 2 improvements across 2 files#836
tomaioo wants to merge 2 commits intoalibaba:masterfrom
tomaioo:fix/security/path-traversal-allows-arbitrary-file-wri

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented Apr 17, 2026

Summary

fix(security): 2 improvements across 2 files

Problem

Severity: High | File: rock/sdk/builder/provider/dockerfile_builder.py:L36

The build_terminal_bench method writes files using untrusted keys from instance_record["files"] directly into f"{build_dir}/{file_name}" without path normalization or boundary checks. An attacker can provide filenames like ../../../../etc/cron.d/pwn to write outside build_dir, potentially overwriting arbitrary files on the host.

Solution

Normalize and validate each target path before writing. Use Path(build_dir) / file_name, resolve it, and enforce that it remains within build_dir (e.g., resolved_path.is_relative_to(build_dir_resolved) in Python 3.9+ equivalent logic). Reject absolute paths and parent traversal (..) segments.

Changes

  • rock/sdk/builder/provider/dockerfile_builder.py (modified)
  • rock/admin/scheduler/tasks/container_cleanup_task.py (modified)

tomaioo added 2 commits April 16, 2026 23:10
- Security: Path traversal allows arbitrary file write during Dockerfile build
- Security: Shell command injection risk in scheduled container cleanup task

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
- Security: Path traversal allows arbitrary file write during Dockerfile build
- Security: Shell command injection risk in scheduled container cleanup task

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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