Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass a wildcard suffix to --allow-env #24847

Closed
ari-becker opened this issue Aug 2, 2024 · 1 comment
Closed

Pass a wildcard suffix to --allow-env #24847

ari-becker opened this issue Aug 2, 2024 · 1 comment
Labels
permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)

Comments

@ari-becker
Copy link

MYAPP_HELLO=world deno run '--allow-env=MYAPP_*' <(echo 'console.log(Deno.env.get("MYAPP_HELLO"))')

This should permit access to MYAPP_HELLO instead of refusing access.

Allowing this will make the list of permitted environment variables more maintainable, while ensuring that environment variables from the host system ($USER, $HOME, $PATH, etc.) remain blocked. This is similar to features like Vite's support for environment variables, where only environment variables with a given prefix (VITE_) will be bundled in, thus providing protection against unintended environment variables being allowed.

@lucacasonato lucacasonato added permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed) labels Aug 2, 2024
@Radiergummi
Copy link

This would be amazing. Prefixing environment values with an app identifier is good practice anyway, so that'd make both the list of permissions more manageable, and promote conventions around variable naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

3 participants