Skip to content

fix: grant unrestricted --allow-write so PERSIST can be any directory (#65) - #72

Merged
jonbaldie merged 3 commits into
mainfrom
fix/65-unrestricted-write-persist
Aug 31, 2026
Merged

fix: grant unrestricted --allow-write so PERSIST can be any directory (#65)#72
jonbaldie merged 3 commits into
mainfrom
fix/65-unrestricted-write-persist

Conversation

@jonbaldie

Copy link
Copy Markdown
Owner

Summary

Dockerfile/CI compiled main.ts with --allow-write=./persist.dat, granting write access to exactly one hardcoded path. At runtime, PERSIST sets the persistence directory and FileStore writes ${PERSIST}/persist.dat. Any PERSIST value other than the compile-time path — including the README's own documented invocation (PERSIST=/mnt/) — crashed the compiled binary with NotCapable during startup, before binding a port.

Fix

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 Dockerfile and 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 --persist against a PERSIST directory unknown at compile time, and asserts it reaches Listening on.

Verification

  • Confirmed RED against the original restricted --allow-write=./persist.dat flag (exact NotCapable crash from the issue).
  • Confirmed GREEN after widening to unrestricted --allow-write.
  • Full deno test suite: 217 passed, 0 failed.

Fixes #65

🤖 Generated with Claude Code

…#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
jonbaldie and others added 2 commits August 31, 2026 12:50
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
@jonbaldie
jonbaldie merged commit ff909f9 into main Aug 31, 2026
4 checks passed
@jonbaldie
jonbaldie deleted the fix/65-unrestricted-write-persist branch August 31, 2026 13:05
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.

Compiled binary crashes on startup with any PERSIST dir: --allow-write allowlist is ./persist.dat only

1 participant