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

feat: support overlapping permissions #6561

Merged
merged 2 commits into from
Dec 10, 2023

Conversation

mattsse
Copy link
Member

@mattsse mattsse commented Dec 10, 2023

Closes #6554

make permission checking more granular.
allows adding deviating rules for sub-folders.

before we found the first matching permission.
now this finds the deepest matching permission.

For example, for path "./cache/file.txt" with

fs_permissions = [{ access = "read", path = "./"}, { access = "write", path = "./cache"}]

this will use { access = "write", path = "./cache"}

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

lgtm, imo this is actually correct behavior. I do think we might get some comments about this changing in the support chat though

pub fn find_permission(&self, path: &Path) -> Option<FsAccessPermission> {
self.permissions.iter().find(|perm| path.starts_with(&perm.path)).map(|perm| perm.access)
// self.permissions.iter().find(|perm| path.starts_with(&perm.path)).map(|perm| perm.access)
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 might want to delete this?

@mattsse
Copy link
Member Author

mattsse commented Dec 10, 2023

I do think we might get some comments about this changing in the support chat though

I don't think this breaks anything, instead I'd consider this a bug-fix

@mattsse mattsse merged commit 0ae39ea into foundry-rs:master Dec 10, 2023
19 checks passed
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.

Filesystem permissions depends on ordering of permission sets
2 participants