Repository navigation
test: restore example solvers - #68
Merged
Merged
Conversation
createBuildContext writes each challenge file with tar.FileInfoHeader, which records the owner the file has on the build host. The classic builder ignored that: a Dockerfile COPY without --chown always produced files owned by root. BuildKit, selected explicitly since 07b9d6e, keeps the owner the context entry carries, so since then every plain COPY in a cork-built image has been owned by whoever owns the challenge tree where it was built, not by root. Found by the examples check that follows: the multi-container example installs a sudoers drop-in with a plain COPY, sudo refuses a drop-in not owned by root ("owned by uid 1000, should be 0"), and its solver waited at a password prompt until it timed out. Every context entry now says root, as artifact archives already do. Nothing hashes the context's headers, so this changes no build's identity: an image built since 07b9d6e keeps its owners until its challenge is rebuilt for another reason.
`cmgr test --require-solve examples` used to do this in CI. It went with the in-process CLI in 19e25e2, its CI step followed in 4c81a10, and since then nothing built most of the corpus: the e2e fleet builds four of the eight examples, by hand, and runs one solver. ci/examples/run.sh starts a corkd on the runner's own docker daemon (no registry, no workers) and, for every challenge it finds: - builds it through POST /challenges/<id> - checks the recorded flag, and that a build publishing artifacts left a readable archive in the artifact directory - for a service, launches it as the platform does (user_id and env), runs its solver on the instance's network, then stops it and checks its containers and network are gone - for artifact-only and flag-only, checks a launch is refused and runs the solver on the default network - destroys the build The solver runs the way examples/solvers.md describes, which this rewrites to match: solver/ plus the extracted artifacts and lookup values, in the default image ci/examples/solver.Dockerfile unless it brings its own, under cork's seccomp policy, and must write the build's flag within ten minutes. A challenge without a solver fails unless it is flag-only. It runs as a job of its own in go.yml, amd64 only, against a docker:$DOCKER_ENGINE-dind engine (29.10.0, what production runs, with overlay2 as production configures it) rather than the runner's own, which lags it: an engine before 29.6.0 cannot pull a base image for a build with no client session, which is how cork builds (moby/moby#48112; 29.4.3 and 29.5.3 fail, 29.6.0 to 29.10.0 build, the runner shipped 29.4.2). The e2e never met this because its builder is a pinned dind too. The disks example's base image is built through the Actions cache on the runner and handed to that engine. Checked on Docker Desktop 29.9.3 and on a cold docker:29.10.0-dind engine set up as the job sets it up (189 s): all eight examples pass with the ownership fix; without it the multi-container example's solver hangs at sudo's password prompt.
hi-liang
force-pushed
the
test/example-solvers
branch
from
November 17, 2026 18:08
46d781f to
80b05b7
Compare
hi-liang
added a commit
that referenced
this pull request
Nov 25, 2026
Covers what landed since v1.3.0: preloading (#55), difficulty in problem.md (#62), single-certificate re-issue (#54), the module path rename (#60), worker-down across a restart (#63), the public address in the schema state (#75) and root-owned COPY (#68). Dependency bumps and CI/e2e upkeep are left out, as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build, deliver and solve every example on each PR
cork lost its example coverage when
cmgr testwent away (19e25e2, 4c81a10). Since then CI has built none of the corpus; the manual e2e builds four of the eight examples and runs one solver.Changes
fix(build): every build-context entry is now owned by root. BuildKit (selected in 07b9d6e) keeps the owner a context file arrives with, so a plainCOPYproduced files owned by whoever owns the challenge tree on the build host, not root. The new check caught it: the multi-container example's sudoers file was ignored, so its solver hung. A unit test fails without the fix.test(ci):ci/examples/run.shruns as a newexamplesjob (amd64 only). It starts a corkd on the runner's Docker daemon and, for each example:Only a flag-only challenge may lack a solver. The disks base image is built through the Actions cache.
examples/solvers.mdnow describes the contract as it runs. pwntools was never preinstalled, andmetadata.jsonwas undocumented.Verification
On Docker 29.10.0, all 8 examples pass in about 3 min. Without the fix, the multi-container example's solver times out.
Not addressed here: build ids are reused after a destroy (
buildshas no AUTOINCREMENT). That will be a separate PR.