fix: grant unrestricted --allow-write so PERSIST can be any directory (#65) - #72
Merged
Merged
Conversation
…#65) The Dockerfile and CI compiled main.ts with --allow-write=./persist.dat, which grants write access to exactly one hardcoded path. At runtime the PERSIST env var sets the persistence directory (config.ts), and FileStore writes to ${PERSIST}/persist.dat. Any PERSIST value other than the single compile-time-allowlisted path — including the README's own documented invocation (PERSIST=/mnt/) — crashed the compiled binary with NotCapable during the startup load sequence, before binding a port. PERSIST is a runtime env var with no fixed value at docker build time, so a per-path allowlist can't work in general. Widened --allow-write to unrestricted in both the Dockerfile and CI build step. Added a regression test to tests/compiled_binary_test.ts (the seam introduced for #64) that compiles the binary with the fixed flags and starts it with --persist against a PERSIST directory unknown at compile time, confirming it reaches "Listening on". Fixes #65 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q25veeccRvgA5zjp6Fhijq
Same fix as fix/64-restricted-env-access: Stryker's commandRunner runs the full deno test suite per mutant (coverageAnalysis is off), and tests/compiled_binary_test.ts is a slow build/integration test that also crashes under Stryker's env-instrumented sandbox (it compiles main.ts with a fixed --allow-env allowlist that doesn't grant __STRYKER_ACTIVE_MUTANT__). It has nothing to contribute to mutation score, so excluded it via --ignore, mirroring how mutation/mutasaurus_ci.ts already scopes to an explicit test file list. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q25veeccRvgA5zjp6Fhijq
# Conflicts: # Dockerfile # tests/compiled_binary_test.ts
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.
Summary
Dockerfile/CI compiledmain.tswith--allow-write=./persist.dat, granting write access to exactly one hardcoded path. At runtime,PERSISTsets the persistence directory andFileStorewrites${PERSIST}/persist.dat. AnyPERSISTvalue other than the compile-time path — including the README's own documented invocation (PERSIST=/mnt/) — crashed the compiled binary withNotCapableduring startup, before binding a port.Fix
PERSISTis a runtime env var with no fixed value atdocker buildtime, so a per-path allowlist can't work in general. Widened--allow-writeto unrestricted in bothDockerfileand the CI build step, per the issue's own fix-options analysis.Added a regression test to
tests/compiled_binary_test.ts(introduced in #64/#71) that compiles the binary with the fixed flags, starts it with--persistagainst aPERSISTdirectory unknown at compile time, and asserts it reachesListening on.Verification
--allow-write=./persist.datflag (exactNotCapablecrash from the issue).--allow-write.deno testsuite: 217 passed, 0 failed.Fixes #65
🤖 Generated with Claude Code