-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
Component
Forge
Have you ensured that all of these are up to date?
- FoundryFoundryupTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
What version of Foundry are you on?
forge Version: 1.2.1-stable Commit SHA: 42341d5 Build Timestamp: 2025-05-26T05:24:48.799227114Z (1748237088) Build Profile: maxperf
What version of Foundryup are you on?
No response
What command(s) is the bug in?
forge script
Operating System
Linux
Describe the bug
When you have a foundry.toml
with the following fs_permissions
:
fs_permissions = [
{ access = "read", path = "./" },
{ access = "write", path = "./" }
]
either vm.readFile
or vm.writeFile
won't work because when forge checks if a path is permitted a certain kind of access it looks by path:
pub fn is_path_allowed(&self, path: &Path, kind: FsAccessKind) -> bool {
self.find_permission(path).map(|perm| perm.is_granted(kind)).unwrap_or_default()
}
now there is read-write
permission, but it's very confusing to get an error with the configuration above.
I'd gladly open a PR but I wanted advice on what should be the solution:
- document this issue in the docs
- disallow having the same path twice
- refactor
is_path_allowed
to find all permissions for a path - when reading
foundry.toml
combine permissions that are for the same file
Dustin4444
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Backlog
Milestone
Relationships
Development
Select code repository
Activity
mattsse commentedon May 31, 2025
imo doing
would be the appropriate fix here
is_path_allowed
#10679[-]Having both a `access = read` and `access = write` for the same path in `fs_permissions` does not work[/-][+]bug(forge): Having both a `access = read` and `access = write` for the same path in `fs_permissions` does not work[/+]