question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use minimum system permissions necessary

See original GitHub issue

I noticed that the default dev script invokes itself with full permissions over the entire system. Ideally, Lume should function fine if invoked with the following minimum permissions.

$ deno run --allow-net=localhost:3000 --allow-read=./ --allow-write=./_site lume/task.ts

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
oscaroterocommented, Sep 21, 2022

task.ts and ci.ts works as wrappers to execute the real CLI script (cli.ts). This wrapper fixes different issues. So, restricting permissions to these files has no effect to cli.ts(AFAIK, permissions are not propagated between childprocesses: a file with only --allow-run could run a script passing the --allow-all argument).

The use cases are so variable that this is the reason I’ve decided to run cli.ts with --allow-all, for example:

  • Sites that fetch data from an external API, needs allow-net or allow-net=api-url.
  • Sites that have different configurations depending on the environment variables (like ENV=dev) needs --allow-env.
  • Sites that need to run some scripts during the build needs --allow-run
  • Sites that use some binary libraries connected with ffi needs --allow-ffi.
  • Sites that use WebAssembly libraries needs --allow-read to read the WebAssembly file.

Restricting the permissions right now can break many sites. I think it’s better to let the users configure the permisisions once Deno team implements permission configuration in the deno.json file. In Lume 2.0 I’m planning to remove these wrapper files and depend only on deno.json that will be mandatory (unlike now, that both deno.json and import_map.json files are optional).

If you’re concerned about that, the correct way to apply permissions is by running the cli.ts file directly. You can create a task like this:

{
  "importMap": "import_map.json",
  "tasks": {
    "lume": "deno run --unstable --allow-read=./ --allow-write=./ --allow-net=localhost https://lume.land/x/lume@1.11.4/cli.ts",
    "build": "deno task lume",
    "serve": "deno task lume -s"
  }
}

This conversation makes me think that a Permissions section in the documentation website would be really useful for users that want to restrict these permissions.

0reactions
oscaroterocommented, Dec 22, 2022

Permissions are explained here: https://lume.land/docs/advanced/permissions/ Closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing Least-Privilege Administrative Models
The principle states that all users should log on with a user account that has the absolute minimum permissions necessary to complete the ......
Read more >
Principle of least privilege - Wikipedia
In information security, computer science, and other fields, the principle of least privilege (PoLP), also known as the principle of minimal privilege (PoMP) ......
Read more >
What Is Least Privilege & Why Do You Need It? - BeyondTrust
When applied to people, the principle of least privilege (POLP), means enforcing the minimal level of user rights, or lowest clearance level, ...
Read more >
What is the Principle of Least Privilege (POLP)? - TechTarget
Users are granted permission to read, write or execute only the files or resources necessary to do their jobs. This principle is also...
Read more >
What is the Principle of Least Privilege (POLP)? A Best ...
The principle of least privilege is the idea that at any user, program, or process should have only the bare minimum privileges necessary...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found