deno icon indicating copy to clipboard operation
deno copied to clipboard

Revoke permissions is not working

Open onepseudoxy opened this issue 2 years ago • 4 comments

I tried to run the last code snippet in the section 'Revoke permissions' present in your web page 'https://deno.land/manual/runtime/permission_apis', using the command line "deno run --allow-read=/foo main.ts": but, I don't get expected output. Following is what I get:

D:\vsc\tools\runtimes\deno\deno-aio-ot\src>deno run --allow-read=/foo main.ts PermissionStatus { state: "prompt", onchange: null } PermissionStatus { state: "prompt", onchange: null }

I'm ran the code on windows 10 (uefi without csm) besides Ubuntu and in both cases it's not working. In case of Windows, The folder D:\vsc\tools\runtimes\deno\deno-aio-ot\src contain the file "main.ts" and the folder "foo", and the later contains "bar" folder.

Following is the output of running "deno --version" command

deno --version deno 1.23.0 (release, x86_64-pc-windows-msvc) v8 10.4.132.5 typescript 4.7.2

onepseudoxy avatar Jun 26 '22 10:06 onepseudoxy

This docs page was written assuming UNIX file paths, not Windows ones. On Windows you probably need to update the file paths to be a proper Windows style path.

lucacasonato avatar Jun 26 '22 18:06 lucacasonato

Oh those docs are out of date as of #12159, I forgot to update them

nayeemrmn avatar Jun 26 '22 18:06 nayeemrmn

I just noticed that revoking the weak permission desc, revoke also the strong one strongDesc, look at the output of the following code snippet

// deno run --allow-read=/foo main.ts const desc = { name: 'read', path: '/foo/bar' } as const; const strongDesc = { name: 'read', path: '/foo' } as const; console.log(await Deno.permissions.query(desc)); console.log(await Deno.permissions.revoke(desc)); // Insufficient. console.log(await Deno.permissions.query(strongDesc)); // PermissionStatus { state: "granted" } await Deno.permissions.revoke(strongDesc); // Good. console.log(await Deno.permissions.query(desc)); // PermissionStatus { state: "prompt" }

The output is:

deno run --allow-read=/foo main.ts PermissionStatus { state: "granted", onchange: null } PermissionStatus { state: "prompt", onchange: null } PermissionStatus { state: "prompt", onchange: null } PermissionStatus { state: "prompt", onchange: null }

onepseudoxy avatar Jun 26 '22 19:06 onepseudoxy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 08 '22 21:09 stale[bot]