Can I allow a compiled Deno executable to access a single hostname provided at runtime?

Viewed 110

I have a service that makes network requests to an external backing service. The requests use TLS, so I can't use any kind of hostname aliasing, and there are different hostnames for development and production environments.

I know that I can use deno package to bundle my application into a single runnable app.js and then have my container command be

deno run --allow-net=${BACKING_SERVICE_HOSTNAME} app.js

However, it would be nice to be able to use deno compile to produce a runnable binary. For that, permissions must be provided at build time, so am I stuck either allowing my app to make all network calls (--allow-net) or providing all the hostnames that development and production deployments might need at once? Or is there a way to allow network calls to only one host, but provide that host at runtime?

1 Answers

Right now there is no way to downgrade the permissions of a program using the current permissions API

A request for such feature was made due to this conversation, so that might change in the near future

Related