Performance: File system permissions (--allow-read, --allow-write)
This concept affects the security and startup time of Deno scripts by controlling file system access permissions.
deno run --allow-read=./data --allow-write=./output script.ts
deno run --allow-read --allow-write script.ts
| Pattern | Permission Scope | Startup Delay | Security Risk | Verdict |
|---|---|---|---|---|
| Full --allow-read and --allow-write | Entire file system | Medium delay due to broad checks | High risk | [X] Bad |
| Scoped --allow-read and --allow-write | Specific directories only | Minimal delay | Low risk | [OK] Good |
--allow-read flag do when running a Deno program?--allow-read--allow-write is for writing, not reading. Network access is unrelated.--allow-read = read permission [OK]app.ts with permission to write files?deno run and before the script name.deno run --allow-write app.ts is correct; options A and C have wrong order, D uses wrong flag.deno run [OK]readfile.ts that reads data.txt and prints its content. What happens if you run deno run readfile.ts without any flags?--allow-read, Deno denies file reading for safety.data.txt without permission causes a runtime error.--allow-read means no file reading [OK]log.txt. Running deno run --allow-read write.ts causes a permission error when writing. What is the fix?--allow-write, not just --allow-read.--allow-write to allow file writing.--allow-write flag when running the script. -> Option A--allow-write [OK]input.txt and writes to output.txt. Which command correctly grants the minimum permissions needed?--allow-read=path and --allow-write=path limits access to specific files.input.txt and write permission for output.txt is needed.Pass the test and this pattern moves unknown