Repository navigation
test: run the test suite in a Docker sandbox - #43
Merged
Merged
Conversation
Tests now run only in a locked-down container: the repo is copied in through an allowlisted build context, with a read-only filesystem, a non-root user, all capabilities dropped and no-new-privileges. Every test file imports a guard that refuses to run outside the sandbox from any working directory, and guard-coverage.test.ts fails if a test file lacks it. The just recipes, ci.yml and the auto-release Verify step all run tests through docker compose. Closes #42
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.
Closes #42
Runs the whole test suite inside a hardened Docker container, so a test that shells out can't touch the host.
Dockerfile.testandcompose.yaml(servicetest): the repo is copied into the image, with a read-only root filesystem, tmpfs/tmp, a non-root user, all capabilities dropped andno-new-privileges..dockerignoreis an allowlist: onlysrc/,tests/,scripts/and the package/tsconfig files go in, and credential and secret names are re-excluded at any depth.tests/setup/require-sandbox.test.tsfirst. It refuses to run outside the container, from any cwd, andtests/setup/guard-coverage.test.tsfails if a test file is missing the import.just test,test-coverage,coverage-checkandtest-watchrun throughdocker compose. CI and the release Verify step do the same, while lint, typecheck and build stay on the runner.docs/DEVELOPMENT.mddescribes what is and isn't contained: network access is still on, and a PR that edits the guard is caught only by review.