Open
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Backlog