-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Description
Intro
Deno's permission system is a distinctive feature that is useful for secure plugin systems and sandboxing.
However, there is currently no way to change permissions during execution other than using a tty-based prompter. This limits the possible uses.
Therefore, I propose making it possible to change Web Worker permissions not only at startup but also after startup.
This will allow users to implement their own user interfaces for managing permissions for the modules they want to execute.
For example, when creating an app that allows users to add extensions, such as vscode, users could be prompted via a GUI to grant file access permissions to the extensions.
Demonstration
// start a worker with no permissions
const worker = new Worker("extension.js", { type: "module", deno: { permissions: "none" } });
worker.onmessage = ({ data }) => {
if (data.event === "requestPermission") {
if (confirm("allow the extension to access local files?")) {
// allow the worker to access local files -- new api
worker.updatePermissions({ read: true });
}
}
};
Metadata
Metadata
Assignees
Labels
No labels