Skip to content

feat: Deno.execPath() no longer requires --allow-read permission #29620

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

Merged
merged 5 commits into from
Jun 25, 2025

Conversation

bartlomieju
Copy link
Member

This commit changes Deno.execPath() API to no longer require
read permission.

This change is dictated by the fact that in common scenarios, requiring
read permission is less secure than not requiring permissions - if
a user wants to spawn a Deno subprocess using the current executable,
they would do something like:

new Deno.Command(Deno.execPath(), { args: ["eval", "1+1"] }).outputSync();

To run this program, currently one needs to pass --allow-read --allow-run=deno flags.
It's possible to limit scope of --allow-read flag, but it's really cumbersome to do,
so most users will opt to give a blanket --allow-read permission.

Not requiring read permissions allows the above program to be run with
just --allow-run=deno flag.

This change is in similar to relaxing of permissions in Deno.cwd() API done
in #27192.

Ref #20061 (comment)

@bartlomieju bartlomieju added this to the 2.4.0 milestone Jun 5, 2025
@bartlomieju bartlomieju merged commit f781796 into denoland:main Jun 25, 2025
18 checks passed
@bartlomieju bartlomieju deleted the exec_path_perm branch June 25, 2025 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants