denoland / denoland/deploy_feedback

Deno.exit permissions querying

Open
#465 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### What problem are you trying to solve?

In Deno Deploy if I call `Deno.exit(1)` it throws a `PermissionDenied` error. This is fine and not unexpected but in other contexts I would like to be able to call `Deno.exit(1)` and so therefore I would like to do a runtime check to see if I have permission to call this function.

When I look at the [`PermissionsDescriptor`](https://deno.land/api@v1.36.0?s=Deno.PermissionDescriptor#typeAlias_PermissionDescriptor) type in the documentation there does not appear to be a descriptor available for the exit function but it seems like there should be.

Therefore this request is to add an `ExitPermissionDescriptor` which would have `name: "exit"` and can never be enabled via command line flags (aka --allow-exit is not a flag) and returns `"granted"` by default. But when queried in deno deploy would return `"denied"` for the permission state.

### Describe the solution you'd like

I would like a new permission to be added which deno deploy sets to denied so we can query for it.

### Describe alternatives you've considered

I can just try/catch the error as a workaround

I can also attempt to look in environment variables to detect that I'm running in Deno Deploy and then wrap the call to exit with logic which checks for those environment variables.

### Documentation, Adoption, Migration Strategy

```ts
const status = await Deno.permissions.query({ name: "exit" });
console.log(status.state); // denied when invoked in Deno Deploy
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with the Deno.permissions.query entry point and the linked PermissionsDescriptor documentation. Confirm the requested exit descriptor behavior across ordinary Deno and Deno Deploy contexts; done means the example query is supported and reports denied in Deno Deploy while remaining granted by default elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cloud, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.