<p dir="auto">Apologies for noise if this has been asked/discussed before—I can't seem to find it.</p>
<p dir="auto"><a href="https://deno.land/manual/getting_started/permissions#permissions-list" rel="nofollow">The manual</a> explains permissions. Some of them have list options, but it doesn't appear that <code class="notranslate">--allow-env</code> currently allows for a list. Is there a reason for this? It seems desirable to be able to restrict access to environment variables while allowing access to specific values.</p>
<p dir="auto">Currently <code class="notranslate">--allow-env</code> gives program unlimited permission to access any environment variable. It's much strong privilege and there should be more limited permission control for them.</p>
<p dir="auto">Like <code class="notranslate">--allow-net=:9999</code>, how about these? <code class="notranslate">--allow-env=DEBUG</code>, <code class="notranslate">--allow-env=DENO_DIR,DENO_INSTALL</code></p>
<p dir="auto"><code class="notranslate">Deno.env()</code> should also be re-designed to get permitted variables.</p>
<p dir="auto">I think even if full access to envars given to the process, It's dangerous to return key-value pair of all environment variables because malicious  attackers are able to  know  some secret informations if they don't know envar's name. So how about re-design <code class="notranslate">Deno.env</code> to immutable map-like object?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Deno.env.get(&quot;DENO_DIR&quot;)
Deno.env.set(&quot;DEBUG&quot;, &quot;*&quot;)
Deno.env.has(&quot;PORT&quot;)"><pre class="notranslate"><code class="notranslate">Deno.env.get("DENO_DIR")
Deno.env.set("DEBUG", "*")
Deno.env.has("PORT")
</code></pre></div>