Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission sets in deno.json #27483

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Dec 27, 2024

POC

{
  "permissionSets": {
    "default": {
      "read": [
        "./deno.jsonc"
      ],
      "env": ["NOCOLOR"],
      "run": [
        "deno"
      ]
    }
  },
  "tasks": {
    "dev": "deno run -P main.ts"
  }
}
deno run -P main.ts

(uses default permission set, you can specify -P=other or --permission-set=other to use another)

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, one thing I'd like to see early in this PR is change for the FS operations that try to modify the deno.json(c) file to require -A permission instead of regular -R/-W.

@dsherret
Copy link
Member

dsherret commented Jan 7, 2025

Looking good, one thing I'd like to see early in this PR is change for the FS operations that try to modify the deno.json(c) file to require -A permission instead of regular -R/-W.

I'm not sure we should have this functionality. I think maybe as part of the risk of using the -P flag, it should be up to the user to inspect or know the state of the deno.json file first (similar to the current risk with deno task). Then someone could add --deny-write=deno.json if they want to mitigate that risk.

deno_core::anyhow::anyhow!(
"failed to find permission set named \"{name}\""
)
})?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't error if someone does -P and the default set doesn't exist. That way someone can run something like deno test -P unconditionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants