Performance: Granular permission scoping
This affects page load speed and security by limiting unnecessary permission requests, reducing blocking prompts and improving user trust.
deno run --allow-read=./data --allow-net=api.example.com script.ts
deno run --allow-all script.ts
| Pattern | Permission Scope | User Prompt Blocking | Script Start Delay | Verdict |
|---|---|---|---|---|
| --allow-all | All permissions | Yes, blocks until user responds | High delay | [X] Bad |
| --allow-read=./data --allow-net=api.example.com | Scoped to needed resources | Minimal blocking | Low delay | [OK] Good |
--allow-read=./data flag do when running a Deno script?--allow-read flag grants permission to read files. When given a path, it limits reading to that path.--allow-read=./data, the script can only read files inside the ./data directory, not outside.--allow-net=host.--allow-net=example.com, which is correct. Other options use incorrect separators or missing equals sign.deno run --allow-read=./files --allow-net=api.example.com script.ts. What will happen if script.ts tries to read ./files/data.txt and fetch from api.example.com?--allow-read=./files allows reading any file inside ./files, so reading data.txt is allowed.--allow-net=api.example.com allows network requests only to api.example.com, so fetching from that API is allowed.deno run --allow-read=./data script.ts but your script tries to read ./config/settings.json and fails. What is the most likely cause?./logs and ./configs directories and fetches data only from api.service.com and cdn.service.com. Which command correctly grants these permissions?--allow-read=path1,path2.Pass the test and this pattern moves unknown