Skip to content

Prevent task images from exposing future Git history - #1

Closed
reinainblood wants to merge 2 commits into
key4127:mainfrom
reinainblood:fix/seal-task-git-history
Closed

reinainblood wants to merge 2 commits into
key4127:mainfrom
reinainblood:fix/seal-task-git-history

Conversation

@reinainblood

Copy link
Copy Markdown

What this fixes

Some released task images are checked out at base_commit but still expose
later, answer-bearing commits through normal Git history. That lets an agent
recover the reference change with git log / git show instead of solving the
task.

I confirmed this in two public images:

  • davidesantangelo__krep-c_1eb6a4a
  • CESNET__libyang-c_8d3d805

In both images the target commit is available after the declared base. On the
files touched by the dataset patch, the stable patch ID of base..target
matches the published golden patch.

Changes

  • Add a pre-agent image preparation tool that keeps base_commit and its
    ancestors while removing later and unreachable Git objects.
  • Preserve the existing worktree, safe Git behavior, nested working
    directories, and initialized submodules; recursively seal submodules to their
    recorded gitlink commits.
  • Preserve the original branch/detached-HEAD state and nearest base tag so
    build tools using git describe --tags continue to work.
  • Add evaluator-owned exact image maps, local-only image selection, a sealed
    history check, pull-failure handling, and selected image IDs in results.
  • Document the pre-inference boundary and the recommendation to publish
    rebuilt/squashed images at immutable digests.

Prediction rows cannot choose their Docker image. When an image map is
supplied, it must cover every evaluated prediction, so a run cannot silently
mix sealed and original images.

Validation

  • 17 Python/shell integration tests pass, including descendant commits,
    attached and detached HEAD, dirty/untracked worktrees, nested paths,
    initialized submodules, total image-map coverage, local-only selection, and
    result image receipts.
  • shellcheck, bash -n, py_compile, and git diff --check pass.
  • Rebuilt the two public images above with the new tool. In each, the known
    target commit is absent and the sealed-history check passes.
  • The official golden evaluator still passes for both rebuilt images,
    including CESNET/libyang's nested /testbed/build working directory.

Scope

This PR supplies the preparation and evaluation controls, but it does not
rewrite already-published image tags. A derived Docker layer removes the old
Git database from the ordinary container view; it does not physically erase
bytes from lower image layers. Agents must remain unprivileged and must not
receive Docker-socket or layer-export access. For a release, the prepared
images should be rebuilt or squashed, published at immutable digests, and
checked across all 170 instances before updating the benchmark image map.

@reinainblood
reinainblood marked this pull request as ready for review August 20, 2026 19:35
@YerbaPage

Copy link
Copy Markdown
Collaborator

Thanks so much for the careful report, the reproductions on krep and libyang, and the work on this PR! Sorry for the delayed response.

We’ve since addressed the future-history exposure through a separate implementation in #2. The rebuilt images remove Git refs outside HEAD’s ancestry and prune unreachable objects, while preserving ancestor tags. As documented in our release notes, the reference patch passes all 170 tasks, and the empty patch fails all 170.

Your caveat about lower image layers still applies: agents must not have Docker-socket or image-export access.

We really appreciate you catching this and contributing a concrete fix. Thank you again!

@YerbaPage YerbaPage closed this Nov 23, 2026
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