OiO.lk Blog security Deno: Use restricted network domains with Redis
security

Deno: Use restricted network domains with Redis


Been having a good time trying out Deno and exploring the security/permissions system. I have a simple web application that connects to redis that I’m configuring a docker-compose setup.

The hostname in the container network is simply redis. When connecting to the redis container using the url redis://redis:6379, The deno application reports the error:

error: Uncaught (in promise) Error: getaddrinfo ENOTFOUND redis

I have narrowed the problem and it appears to be due to me using the restrictive allow-net syntax to specifically allow through hosts. In my case, I want to let through the redis hostname.

CMD ["run", "--allow-net=redis:6379,[::]:8000", "--allow-env",  "--allow-read", "main.ts"]

If I change it to

CMD ["run", "--allow-net", "--allow-env",  "--allow-read", "main.ts"]

And allow any connections, the redis connection is succesfull. Is there an issue with the redis protocol being allowed by Deno when using the restrictive hostname syntax or is something else going on here?



You need to sign in to view this answers

Exit mobile version