Skip to content

fix: grant unrestricted --allow-net so PORT/HOST can differ at runtime (#68) - #73

Merged
jonbaldie merged 3 commits into
mainfrom
fix/68-unrestricted-net-bind
Aug 31, 2026
Merged

fix: grant unrestricted --allow-net so PORT/HOST can differ at runtime (#68)#73
jonbaldie merged 3 commits into
mainfrom
fix/68-unrestricted-net-bind

Conversation

@jonbaldie

Copy link
Copy Markdown
Owner

Summary

Dockerfile/CI compiled main.ts with --allow-net=${DENO_HOST}:${DENO_PORT} (build-time ARGs defaulting to 0.0.0.0:3000), permanently locking the compiled binary to that one bind address. PORT/HOST are read from the runtime env and are documented as overridable (README's docker run -e PORT=1991 ... example). Any runtime PORT/HOST other than the compiled-in address threw NotCapable at Deno.serve, before binding.

Fix

The bind address is a runtime concern with no fixed value at docker build time, so a single hardcoded allowlist entry can't work in general. Widened --allow-net to unrestricted in both Dockerfile and the CI build step, per the issue's own fix analysis, and removed the now-unused DENO_HOST/DENO_PORT build ARGs.

Added a regression test to tests/compiled_binary_test.ts (introduced in #64/#71, #65/#72) that compiles the binary with the fixed flags, starts it with a runtime PORT/HOST different from the old build-time defaults, and asserts it reaches Listening on.

Verification

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

Fixes #68

🤖 Generated with Claude Code

jonbaldie and others added 3 commits August 31, 2026 12:43
#68)

Dockerfile and CI compiled main.ts with --allow-net=${DENO_HOST}:${DENO_PORT}
(build-time ARGs defaulting to 0.0.0.0:3000), permanently locking the
compiled binary to that one bind address. PORT/HOST are read from the
runtime env by parseConfig and are documented as overridable (README's
docker run -e PORT=1991 ... example). Any runtime PORT/HOST other than
the compiled-in address threw NotCapable at Deno.serve, before binding.

The bind address is a runtime concern with no fixed value at docker
build time, so a single hardcoded allowlist entry can't work in
general. Widened --allow-net to unrestricted in both the Dockerfile
and CI build step, and removed the now-unused DENO_HOST/DENO_PORT
build ARGs.

Added a regression test to tests/compiled_binary_test.ts (the seam
introduced for #64/#65) that compiles the binary with the fixed flags
and starts it with a runtime PORT/HOST different from the old
build-time defaults, confirming it reaches "Listening on".

Fixes #68

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 and
fix/65-unrestricted-write-persist: 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
…et-bind

# Conflicts:
#	.github/workflows/ci.yml
#	Dockerfile
#	tests/compiled_binary_test.ts
@jonbaldie
jonbaldie merged commit c0a7f28 into main Aug 31, 2026
4 checks passed
@jonbaldie
jonbaldie deleted the fix/68-unrestricted-net-bind branch August 31, 2026 13:43
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 when PORT/HOST differ from build-time ARGs: --allow-net bakes in 0.0.0.0:3000

1 participant