fix: grant unrestricted --allow-net so PORT/HOST can differ at runtime (#68) - #73
Merged
Conversation
#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
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-net=${DENO_HOST}:${DENO_PORT}(build-timeARGs defaulting to0.0.0.0:3000), permanently locking the compiled binary to that one bind address.PORT/HOSTare read from the runtime env and are documented as overridable (README'sdocker run -e PORT=1991 ...example). Any runtimePORT/HOSTother than the compiled-in address threwNotCapableatDeno.serve, before binding.Fix
The bind address is a runtime concern with no fixed value at
docker buildtime, so a single hardcoded allowlist entry can't work in general. Widened--allow-netto unrestricted in bothDockerfileand the CI build step, per the issue's own fix analysis, and removed the now-unusedDENO_HOST/DENO_PORTbuildARGs.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 runtimePORT/HOSTdifferent from the old build-time defaults, and asserts it reachesListening on.Verification
--allow-net=0.0.0.0:3000flag (exactNotCapablecrash from the issue).--allow-net.deno testsuite: 217 passed, 0 failed.Fixes #68
🤖 Generated with Claude Code