Skip to content

Conversation

barraguda
Copy link
Contributor

@barraguda barraguda commented Feb 29, 2024

Problem

Current paths are often manipulated as strings in the vfs, leading way to attacks that use relative paths, like "/mypkg:mypub.os/pkg/../../some_other_pkg/other_file".

Solution

Canonicalize paths into absolutes, removing any relative paths and checking the absoluts.

Docs Update

Corresponding docs PR

Notes

thanks @bonedaddy for bringing it up in discord!
Caps are matched on literally, so a missing prepended "/" to a path doesn't matter when interacting with the vfs, but when doing get_capability() from the kernel it does.

@dr-frmr
Copy link
Contributor

dr-frmr commented Feb 29, 2024

not bad, any changes required in API docs?

@barraguda
Copy link
Contributor Author

not bad, any changes required in API docs?

nope, not anymore.

Am doing path normalization instead of canonicalization now as the latter requires the path to exist, which often in our case it does not.

Copy link
Contributor

@dr-frmr dr-frmr left a comment

Choose a reason for hiding this comment

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

LGTM

@dr-frmr dr-frmr merged commit e46993a into develop Mar 4, 2024
@dr-frmr dr-frmr deleted the bp/sanitize-paths branch March 4, 2024 16:17
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.

2 participants