mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix: make --allow-env stronger that --deny-env (#29079)
This commit is contained in:
parent
e0813f2255
commit
f2ae7a19f4
4 changed files with 31 additions and 1 deletions
|
@ -1944,7 +1944,7 @@ impl UnaryPermission<EnvQueryDescriptor> {
|
|||
|
||||
pub fn check_all(&mut self) -> Result<(), PermissionDeniedError> {
|
||||
skip_check_if_is_permission_fully_granted!(self);
|
||||
self.check_desc(None, false, None)
|
||||
self.check_desc(None, true, None)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5263,4 +5263,21 @@ mod tests {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_env_check_all() {
|
||||
set_prompter(Box::new(TestPrompter));
|
||||
let parser = TestPermissionDescriptorParser;
|
||||
let mut perms = Permissions::from_options(
|
||||
&parser,
|
||||
&PermissionsOptions {
|
||||
allow_env: Some(vec![]),
|
||||
deny_env: Some(svec!["FOO"]),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert!(perms.env.check_all().is_err());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue