mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
fix: Use "none" instead of false to sandbox Workers (#9034)
This commit is contained in:
parent
cb658f5ce5
commit
b5f1d257a3
4 changed files with 11 additions and 12 deletions
11
cli/dts/lib.deno.shared_globals.d.ts
vendored
11
cli/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -718,16 +718,15 @@ declare class Worker extends EventTarget {
|
||||||
*/
|
*/
|
||||||
// TODO(Soremwar)
|
// TODO(Soremwar)
|
||||||
// `deno: true` is kept for backwards compatibility with the previous worker
|
// `deno: true` is kept for backwards compatibility with the previous worker
|
||||||
// options implementation. Remove for 2.0
|
// options implementation. Remove for 2.0.
|
||||||
deno?: true | {
|
deno?: true | {
|
||||||
namespace?: boolean;
|
namespace?: boolean;
|
||||||
/** Set to false to disable all the permissions in the worker */
|
/** Set to `"none"` to disable all the permissions in the worker. */
|
||||||
permissions?: "inherit" | false | {
|
permissions?: "inherit" | "none" | {
|
||||||
env?: "inherit" | boolean;
|
env?: "inherit" | boolean;
|
||||||
hrtime?: "inherit" | boolean;
|
hrtime?: "inherit" | boolean;
|
||||||
/**
|
/** The format of the net access list must be `hostname[:port]`
|
||||||
* The format of the net access list must be `hostname[:port]`
|
* in order to be resolved.
|
||||||
* in order to be resolved
|
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* net: ["https://deno.land", "localhost:8080"],
|
* net: ["https://deno.land", "localhost:8080"],
|
||||||
|
|
|
@ -600,7 +600,7 @@ Deno.test("Worker with disabled permissions", async function () {
|
||||||
type: "module",
|
type: "module",
|
||||||
deno: {
|
deno: {
|
||||||
namespace: true,
|
namespace: true,
|
||||||
permissions: false,
|
permissions: "none",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -241,7 +241,7 @@ the `deno.permissions` option in the worker API.
|
||||||
type: "module",
|
type: "module",
|
||||||
deno: {
|
deno: {
|
||||||
namespace: true,
|
namespace: true,
|
||||||
permissions: false,
|
permissions: "none",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
|
@ -152,9 +152,9 @@
|
||||||
: deno?.permissions,
|
: deno?.permissions,
|
||||||
};
|
};
|
||||||
|
|
||||||
// If the permission option is set to false, all permissions
|
// If the permission option is set to "none", all permissions
|
||||||
// must be removed from the worker
|
// must be removed from the worker
|
||||||
if (workerDenoAttributes.permissions === false) {
|
if (workerDenoAttributes.permissions === "none") {
|
||||||
workerDenoAttributes.permissions = {
|
workerDenoAttributes.permissions = {
|
||||||
env: false,
|
env: false,
|
||||||
hrtime: false,
|
hrtime: false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue