-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fix output paths #991
Fix output paths #991
Conversation
If authors choose ids w/ path separators, they can traverse the output to write to any destination. These tests will only pass if these problematic paths are sanitized.
BTW -- I searched the whole code base for all cases where we write files to disk to ensure I had captured all the potential issues. I also ran a full regression and confirmed this does not affect an IGs -- which means that no one was using invalid characters, which is good! |
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.
Looks good!
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.
Looks good - I just had one minor comment.
Co-authored-by: Julia Afeltra <[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.
Amazing work!
Fixes #990.
Since SUSHI uses resource ids and IG ids to name files, it is possible to provide an id w/ path traversal characters (e.g.,
/../../
to write to an arbitrary location). Since SUSHI only writesJSON
files, however, note that this can only be used to write/overwrite files w/ a.json
extension.You can test this by first checking out only 7c8a745 and confirming the tests do not pass. Then checking out the rest of the branch and confirming the tests pass.
I am also attaching a simple project (NaughtyPaths.zip) that exercises the bug. If you unzip it and run SUSHI on it:
fsh-generated/resources
)fsh-generated/resources
as expected, with problematic characters converted to-
.