summaryrefslogtreecommitdiff
path: root/runtime/permissions
AgeCommit message (Collapse)Author
2024-06-14chore: upgrade to rust 1.79 (#24207)Satya Rohith
2024-06-13chore: forward v1.44.2 release commit to main (#24194)denobot
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-06-06chore: forward v1.44.1 release commit to main (#24115)denobot
This is the release commit being forwarded back to main for 1.44.1 Co-authored-by: devsnek <devsnek@users.noreply.github.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-301.44.0 (#24045)denobot
Bumped versions for 1.44.0 Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-05-22chore: forward v1.43.6 release commit to main (#23936)Bartek Iwańczuk
Bumped versions for 1.43.6 Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-17chore: forward v1.43.4 commit to main (#23861)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-16fix(ext/node): homedir() `getpwuid`/`SHGetKnownFolderPath` fallback (#23841)Divy Srivastava
**Unix**: Returns the value of the HOME environment variable if it is set even if it is an empty string. Otherwise, it tries to determine the home directory by invoking the [getpwuid_r](https://linux.die.net/man/3/getpwuid_r) function with the UID of the current user. **Windows**: Returns the value of the USERPROFILE environment variable if it is set and it is not an empty string. Otherwise, it tries to determine the home directory by invoking the [SHGetKnownFolderPath](https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath) function with [FOLDERID_Profile](https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid). Fixes https://github.com/denoland/deno/issues/23824
2024-05-13chore: cleanup unused dependencies (#23787)Leo Kettmeir
2024-05-10chore: forward v1.43.3 release commit to main (#23771)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-10fix(runtime): Allow opening /dev/fd/XXX for unix (#23743)Matt Mastracci
`deno run script.ts <(some command)` is a valid use case -- let's allow this to work without `--allow-all`. Fixes #23703
2024-05-08chore: enable clippy::print_stdout and clippy::print_stderr (#23732)David Sherret
1. Generally we should prefer to use the `log` crate. 2. I very often accidentally commit `eprintln`s. When we should use `println` or `eprintln`, it's not too bad to be a bit more verbose and ignore the lint rule.
2024-05-09chore: forward v1.43.2 release commit to main (#23749)denobot
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED** This is the release commit being forwarded back to main for 1.43.2 Please ensure: - [x] Everything looks ok in the PR - [x] The release has been published To make edits to this PR: ```shell git fetch upstream forward_v1.43.2 && git checkout -b forward_v1.43.2 upstream/forward_v1.43.2 ``` Don't need this PR? Close it. cc @nathanwhit Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com> Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-08fix(runtime): allow nul device on windows (#23741)Matt Mastracci
Fixes [23721](https://github.com/denoland/deno/issues/23721)
2024-05-07fix(runtime): allow r/w access to /etc without --allow-all (#23718)Luca Casonato
This is not a special path that can be used to escalate or bypass Deno permissions, such as `--allow-env`.
2024-05-011.43.0 (#23629)denobot
Bumped versions for 1.43.0 Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-251.43.0 (#23549)denobot
Bumped versions for 1.43.0 Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-19feat(runtime): Allow embedders to perform additional access checks on file ↵Matt Mastracci
open (#23208) Embedders may have special requirements around file opening, so we add a new `check_open` permission check that is called as part of the file open process.
2024-04-16chore: forward v1.42.4 commit to `main` (#23394)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-12chore: forward v1.42.3 release commit to main (#23335)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-11chore: forward v1.42.2 release commit to main (#23315)denobot
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-04fix(runtime): fix Windows permission prompt (#23212)Matt Mastracci
Followup to https://github.com/denoland/deno/pull/23184
2024-04-02fix(cli): Enforce a human delay in prompt to fix paste problem (#23184)Matt Mastracci
The permission prompt doesn't wait for quiescent input, so someone pasting a large text file into the console may end up losing the prompt. We enforce a minimum human delay and wait for a 100ms quiescent period before we write and accept prompt input to avoid this problem. This does require adding a human delay in all prompt tests, but that's pretty straightforward. I rewrote the locked stdout/stderr test while I was in here.
2024-04-01chore: forward v1.42.1 release commit to main (#23162)denobot
This is the release commit being forwarded back to main for 1.42.1 Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-03-281.42.0 (#23105)denobot
Bumped versions for 1.42.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-26fix(runtime): use FQDN in NetDescriptor (#23084)Nayeem Rahman
2024-03-14chore: Forward 1.41.3 release commit (#22930)Nathan Whitaker
Forward 1.41.3 release commit Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-03-13perf(permissions): Fast exit from checks when permission is in ↵Matt Mastracci
"fully-granted" state (#22894) Skips the access check if the specific unary permission is in an all-granted state. Generally prevents an allocation or two. Hooks up a quiet "all" permission that is automatically inherited. This permission will be used in the future to indicate that the user wishes to accept all side-effects of the permissions they explicitly granted. The "all" permission is an "ambient flag"-style permission that states whether "allow-all" was passed on the command-line.
2024-03-13chore(permissions): add allow_all flag (#22890)Matt Mastracci
Unlocking a potential perf optimization at a later date -- carry the `allow_all` flag into the permission container.
2024-03-12fix(runtime): negate partial condition for deny flags (#22866)Nayeem Rahman
2024-03-12refactor: add `deno_permissions` crate (#22236)Divy Srivastava
Issue https://github.com/denoland/deno/issues/22222 ![image](https://github.com/denoland/deno/assets/34997667/2af8474b-b919-4519-98ce-9d29bc7829f2) This PR moves `runtime/permissions` code to a upstream crate called `deno_permissions`. The `deno_permissions::PermissionsContainer` is put into the OpState and can be used instead of the current trait-based permissions system. For this PR, I've migrated `deno_fetch` to the new crate but kept the rest of the trait-based system as a wrapper of `deno_permissions` crate. Doing the migration all at once is error prone and hard to review. Comparing incremental compile times for `ext/fetch` on Mac M1: | profile | `cargo build --bin deno` | `cargo plonk build --bin deno` | | --------- | ------------- | ------------------- | | `debug` | 20 s | 0.8s | | `release` | 4 mins 12 s | 1.4s |
2024-02-19feat(core): highlight unprintable chars in permission prompts (#22468)Matt Mastracci
If we strip out unprintable chars, we don't see the full filename being requested by permission prompts. Instead, we highlight and escape them to make them visible.
2024-02-07refactor: extract out `runtime::colors` to `deno_terminal::colors` (#22324)David Sherret
2024-02-07fix: enable "--allow-sys=cpus" for "deno run" (#22260)restlessronin
Fixes #22221 with the suggested fix, and added "cpus" to the existing tests.
2024-01-05fix(ext/node): add fs.cp, fs.cpSync, promises.cp (#21745)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20803 Fixes https://github.com/denoland/deno/issues/21723 Performance: copying a 48GiB rust `target` folder (recursive) | Platform | `deno` | `node v21.5` | Improvement | | -------- | ------- | ------- | ------- | | macOS (APFS) | 3.1secs | 127.99 secs | **42x** | | Windows | 18.3secs | 67.2secs | **3.8x** | Copying files with varying sizes: ![image](https://github.com/denoland/deno/assets/34997667/58932652-6f7a-47f5-8504-896dc9ab4ddc)
2024-01-04fix(cli): harden permission stdio check (#21778)Matt Mastracci
Harden the code that does permission checks to protect against re-opening of stdin. Code that runs FFI is vulnerable to an attack where fd 0 is closed during a permission check and re-opened with a file that contains a positive response (ie: `y` or `A`). While FFI code is dangerous in general, we can make it more difficult for FFI-enabled code to bypass additional permission checks. - Checks to see if the underlying file for stdin has changed from the start to the end of the permission check (detects races) - Checks to see if the message is excessively long (lowering the window for races) - Checks to see if stdin and stderr are still terminals at the end of the function (making races more difficult)
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-04perf(node/fs): faster `existsSync` when not exists (#21458)David Sherret
2023-12-01fix(perm): allow-net with port 80 (#21221)Ian Bull
2023-12-01fix(permissions): fix panics when revoking net permission (#21388)liruifengv
fix #21385
2023-10-09refactor: remove TimersPermissions::check_unstable (#20831)Bartek Iwańczuk
This is dead code that was not used in any way. Ref https://github.com/denoland/deno/pull/20797
2023-08-30fix(runtime/permissions): Resolve executable specifiers in allowlists and ↵Nayeem Rahman
queries (#14130) Closes #14122. Adds two extensions to `--allow-run` behaviour: - When `--allow-run=foo` is specified and `foo` is found in the `PATH` at startup, `RunDescriptor::Path(which("foo"))` is added to the allowlist alongside `RunDescriptor::Name("foo")`. Currently only the latter is. - When run permission for `foo` is queried and `foo` is found in the `PATH` at runtime, either `RunDescriptor::Path(which("foo"))` or `RunDescriptor::Name("foo")` would qualify in the allowlist. Currently only the latter does.
2023-08-25chore(cli): remove atty crate (#20275)Matt Mastracci
Removes a crate with an outstanding vulnerability.
2023-08-22feat(ext/kv): connect to remote database (#20178)Heyang Zhou
This patch adds a `remote` backend for `ext/kv`. This supports connection to Deno Deploy and potentially other services compatible with the KV Connect protocol.
2023-08-03feat(permissions): add "--deny-*" flags (#19070)Asher Gomez
This commit adds new "--deny-*" permission flags. These are complimentary to "--allow-*" flags. These flags can be used to restrict access to certain resources, even if they were granted using "--allow-*" flags or the "--allow-all" ("-A") flag. Eg. specifying "--allow-read --deny-read" will result in a permission error, while "--allow-read --deny-read=/etc" will allow read access to all FS but the "/etc" directory. Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly by adding, a new "PermissionStatus.partial" field. This field denotes that while permission might be granted to requested resource, it's only partial (ie. a "--deny-*" flag was specified that excludes some of the requested resources). Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for permissions like "Deno.permissions.query({ name: "read", path: "foo/" })" will return "PermissionStatus { state: "granted", onchange: null, partial: true }", denoting that some of the subpaths don't have read access. Closes #18804. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-07-31feat(node/os): implement getPriority, setPriority & userInfo (#19370)Leo Kettmeir
Takes #4202 over Closes #17850 --------- Co-authored-by: ecyrbe <ecyrbe@gmail.com>
2023-06-26chore: fix typos (#19572)Martin Fischer
2023-06-09chore: fix flaky stdio_streams_are_locked_in_permission_prompt (#19443)David Sherret
2023-06-06chore: upgrade to Rust 1.70.0 (#19345)David Sherret
Co-authored-by: linbingquan <695601626@qq.com>
2023-05-27refactor(node/http): don't use readablestream for writing to request (#19282)Leo Kettmeir
Refactors the internal usage of a readablestream to write to the resource directly --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-24refactor(ext/node): enforce interior mutable for `NodePermissions` to remove ↵David Sherret
clones (#18831) We can make `NodePermissions` rely on interior mutability (which the `PermissionsContainer` is already doing) in order to not have to clone everything all the time. This also reduces the chance of an accidental `borrow` while `borrrow_mut`.