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
Instead of just sandbox: true, I think we should rely on Deno.PermissionOptionsObject, which would make it closer to what Deno.test and deno WebWorker offer in terms of API, in addition to offer more flexibility.
Also maybe a prompt option could be added to decide whether to use Deno.permissions.request or Deno.permissions.query ? Though I don't think there's many use case where someone would want to run some pages in interactive permissions and other in non-interactives). So maybe we can scrap this one.
If the above gets implemented, the #validateRequest method will need to be refactored.
Currently, we use the main realm Deno.permissions object, which also mean that any permissions accepted within sandbox also "leaks" to the main realm and could be see as a security issue.
To avoid re-implementing deno's logic of validating permissions, maybe the easier way to would be to spawn a new WebWorker with the provided permissions descriptor (new WebWorker(..., { deno: { permissions } }) and launch the validation requests from there.
It'd probably create a small overhead, but I think the tradeoff is acceptable as it's an advanced feature and improve security too.
Use the new --allow-imports for <script>
Currently we treat imports from script tag as "net" (like deno used to for dynamic imports), but they have now introduced a new "imports" permissions (though the query descriptor has been forgotten upstream: denoland/deno#27050)
The Deno.PermissionOptionsObject actually already allows the "inherit" (both at granular and global levels), and supports booleans too.
The only thing is that maybe "true" should be replaced by "inherit" by astral for QOL, because passing true when permissions are restricted in main realm throw escalation errors since you're trying to grant more permissions than allowed
Granular permissions
Instead of just
sandbox: true
, I think we should rely onDeno.PermissionOptionsObject
, which would make it closer to whatDeno.test
and denoWebWorker
offer in terms of API, in addition to offer more flexibility.Also maybe a
prompt
option could be added to decide whether to useDeno.permissions.request
orDeno.permissions.query
? Though I don't think there's many use case where someone would want to run some pages in interactive permissions and other in non-interactives). So maybe we can scrap this one.Example:
Realm-aware permissions
If the above gets implemented, the
#validateRequest
method will need to be refactored.Currently, we use the main realm
Deno.permissions
object, which also mean that any permissions accepted within sandbox also "leaks" to the main realm and could be see as a security issue.To avoid re-implementing deno's logic of validating permissions, maybe the easier way to would be to spawn a new
WebWorker
with the provided permissions descriptor (new WebWorker(..., { deno: { permissions } })
and launch the validation requests from there.It'd probably create a small overhead, but I think the tradeoff is acceptable as it's an advanced feature and improve security too.
Use the new
--allow-imports
for<script>
Currently we treat imports from script tag as "net" (like deno used to for dynamic imports), but they have now introduced a new "imports" permissions (though the query descriptor has been forgotten upstream: denoland/deno#27050)
The fetch paused event of CDP is able to know what is trying to be loaded (https://chromedevtools.github.io/devtools-protocol/tot/Network/#type-ResourceType), in particular "Script" element.
So to match the new deno behavior, it may makes more sense to align too on this, since the
<script>
are in a sense dynamic imports.It would also be a nice QOL, because you'd be able to distinguish scripts from other resources (images, etc.)
The text was updated successfully, but these errors were encountered: