You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Chef}from"./src/lib.ts";import{Permissions}from"https://raw.githubusercontent.com/sigmaSd/deno-with-permissions-ts/master/api.ts";constgetEnvPermission=()=>{switch(Deno.build.os){case"linux": {return["XDG_CACHE_HOME","HOME"];}case"darwin": {return["HOME"];}case"windows":
return["LOCALAPPDATA"];}};constpermissions: Permissions={read: [Chef.dbPath,Chef.binPath],// uses internal chef dbPath and binPathwrite: [Chef.dbPath,Chef.binPath],env: getEnvPermission(),net: ["github.com"],};exportdefaultpermissions;
Can I test this right now?
First install a wrapper around deno, with this idea implemented:
deno install --unstable -A -n deno2 https://github.com/sigmaSd/deno-with-permissions-ts/raw/master/main.ts
Then you can try with the chef repo example:
deno2 run --print-generated-permissions=true --permissions=https://github.com/sigmaSd/Chef/raw/permissions/permissions.ts https://github.com/sigmaSd/Chef/raw/permissions/example.ts
The text was updated successfully, but these errors were encountered:
There are no plans to support permissions in JS/TS files, but currently there is a PR going on (#27483) that would implement support for specifying permissions in the config file(#26372, #12763). Gonna close this one in favor of these two other issues.
Text copied from https://github.com/sigmaSd/deno-with-permissions-ts
deno-with-permissions-ts
Deno with more flexible permissions specificaiton
Whats this
A proposal to allow deno users to specify permissions via an external typescript file
Motivation
But all theses permissions are expressable if we use Deno ecosystem, and thus this proposal
How it looks
the user can write a
permissions.ts
(any name), it has to export a default memeber with this signaturehttps://github.com/sigmaSd/deno-with-permissions-ts/blob/master/api.ts
and then the user can run his application with
deno run --permissions=$path_to_permissions_file.ts user_app.ts
Example
Taking https://github.com/sigmaSd/Chef/tree/permissions as an example, here are its permissions
https://github.com/sigmaSd/Chef/blob/permissions/permissions.ts
Can I test this right now?
First install a wrapper around deno, with this idea implemented:
Then you can try with the chef repo example:
The text was updated successfully, but these errors were encountered: