clockworklabs / clockworklabs/SpacetimeDB
Add local-dev opt-in for `ctx.http.fetch` to private/special-purpose addresses
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Summary
When running SpacetimeDB locally, ctx.http.fetch rejects requests to private/special-purpose addresses (for example local
Docker services like MinIO on 127.0.0.1:9000 or 192.168.x.x), returning:
refusing to connect to private or special-purpose addresses
This blocks legitimate local-development setups where a module needs to call an object-storage service running on the same
machine/network, like in my case a S3 api compatible storage container.
Evidence
- Runtime log:
ProcedureHttpRequest returned errno: 21 (The HTTP request failed)- Error message:
refusing to connect to private or special-purpose addresses
- Source references:
crates/core/src/host/instance_env.rsBLOCKED_HTTP_ADDRESS_ERRORconstantFilteredDnsResolverfilters resolved IPs viais_blocked_ip(...)- blocked ranges include loopback/private/link-local/etc
Reproduction
- Run SpacetimeDB locally.
- Create a procedure that calls
ctx.http.fetchto a local service endpoint (for examplehttp://127.0.0.1:9000/...). - Invoke the procedure.
- Observe failure with the blocked-address error above.
Why this matters
This is a sensible default for production SSRF protection, but local development often relies on Docker-local services and
private network addresses. There is currently no documented local-dev override.
Requested behavior
Add an explicit opt-in local-dev override so private/special-purpose address egress can be enabled intentionally during
local development only.
Possible safe designs:
spacetime startflag (for local only), e.g.--allow-private-http-egress- Config-based allowlist of hostnames/CIDRs for module HTTP egress
- Capability-style per-database/per-module egress policy
Thanks for considering this — this would unblock common local Docker workflows without changing production defaults.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/core/src/host/instance_env.rs by reading BLOCKED_HTTP_ADDRESS_ERROR, FilteredDnsResolver, and is_blocked_ip(...). Compare the proposed local-only flag, hostname/CIDR allowlist, and per-database or per-module policy against the local Docker reproduction. Done means a deliberate local-development opt-in permits the intended private addresses while production defaults remain blocked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100