Skip to content

Add HTTP egress policy option#5506

Open
clockwork-labs-bot wants to merge 2 commits into
masterfrom
bot/restrict-http-egress-loopback
Open

Add HTTP egress policy option#5506
clockwork-labs-bot wants to merge 2 commits into
masterfrom
bot/restrict-http-egress-loopback

Conversation

@clockwork-labs-bot

@clockwork-labs-bot clockwork-labs-bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Adds a runtime HTTP egress policy for module HTTP requests.

The default policy preserves existing behavior:

  • Production/default builds block loopback plus private/special-purpose ranges, while allowing normal public addresses.
  • Builds with allow_loopback_http_for_tests default to allowing loopback for tests, while still allowing normal public addresses.

A separate loopback-only policy blocks all non-loopback resolved and literal IP addresses. Standalone exposes this as --http-egress-policy with these values:

  • public-internet
  • allow-loopback
  • loopback-only

The same policy can also be set in config.toml as http-egress-policy.

API and ABI breaking changes

None.

Expected complexity level and risk

  1. The HTTP filter behavior is still localized to InstanceEnv, but the selected policy is now wired through standalone config, host runtime config, module creation, and both WASM and V8 instance creation.

Testing

  • PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH cargo fmt --all
  • LC_ALL=C LC_CTYPE=C LANG=C PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH cargo test -p spacetimedb-core host::instance_env::test:: --lib
  • LC_ALL=C LC_CTYPE=C LANG=C PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH cargo test -p spacetimedb-core --features allow_loopback_http_for_tests host::instance_env::test:: --lib
  • LC_ALL=C LC_CTYPE=C LANG=C PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH cargo test -p spacetimedb-core config::tests:: --lib
  • LC_ALL=C LC_CTYPE=C LANG=C PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH cargo test -p spacetimedb-standalone subcommands::start::tests:: --lib
  • LC_ALL=C LC_CTYPE=C LANG=C PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH cargo check -p spacetimedb-testing
  • git diff --check

@clockwork-labs-bot clockwork-labs-bot changed the title Restrict test HTTP egress to loopback Add HTTP egress policy option Jul 10, 2026
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.

1 participant