-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat(permissions): allow flags should override deny when more specific #31224
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Copilot <[email protected]> Signed-off-by: David Sherret <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the permission system to improve handling of granular allow and deny rules. The main change replaces separate HashSet-based storage for granted, flag-denied, and prompt-denied descriptors with a unified sorted vector-based approach, enabling more precise permission resolution with partial denials.
- Changed data structure from
HashSet-based to sortedVec-based descriptor storage - Added
DeniedPartialstate to distinguish between full and partial denials - Implemented comparison traits for descriptor ordering to support binary search
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| runtime/permissions/lib.rs | Core refactoring: unified descriptor storage, added sorting/comparison logic, implemented partial denial handling |
| runtime/permissions/Cargo.toml | Added test features for sys_traits dependency |
| runtime/ops/permissions.rs | Updated PermissionStatus to use static string for state and handle DeniedPartial |
| libs/config/deno_json/permissions.rs | Added helper method and simplified empty check logic |
| cli/args/mod.rs | Renamed variable from no_op to identity for clarity |
| Cargo.toml | Updated fqdn dependency from 0.3.4 to 0.4.6 |
| Cargo.lock | Updated fqdn package checksum and version |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| state.to_string() | ||
| state: match state { | ||
| PermissionState::Granted | PermissionState::GrantedPartial => "granted", | ||
| PermissionState::DeniedPartial | PermissionState::Denied => "denied", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This DeniedPartial isn't used at the moment, but it's useful granularity to have. I'll use it in a future PR that I extract out of #31187
Co-authored-by: Copilot <[email protected]> Signed-off-by: David Sherret <[email protected]>
Allow flags that are more specific than deny flags should take precedence.
Some examples:
--allow-read=./data/sub --deny-read=./data--allow-env=NODE_ENV --deny-read=NODE_*Extracted out of #31187 -- This behaviour will be more important when the
--ingore-envflag is added in order to make the feature more powerful.