Skip to content

Conversation

@dsherret
Copy link
Member

@dsherret dsherret commented Nov 7, 2025

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-env flag is added in order to make the feature more powerful.

Copilot AI review requested due to automatic review settings November 7, 2025 22:55
Copy link
Contributor

Copilot AI left a 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 sorted Vec-based descriptor storage
  • Added DeniedPartial state 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",
Copy link
Member Author

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

dsherret and others added 2 commits November 7, 2025 23:57
Co-authored-by: Copilot <[email protected]>
Signed-off-by: David Sherret <[email protected]>
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.

1 participant