Open fatcerberus opened 6 years ago
Sandboxing has been further strengthened for miniSphere 5.3 (relaxed
and none
modes are no longer honored in production at all) to shore up the security of the SPK format, so this issue has become even less important. It might not even be worth solving now, especially since FS.relativePath
is only intended for display.
That said, I'll leave the issue open as it's tagged back burner
. So if I get bored enough I might just fix it anyway. :o)
There is currently a bug in
FS.relativePath
which prevents it from working as expected when both the input path and base path refer to the physical file system ("are absolute paths"). There is an overly broad short-circuit condition ingame_relative_path
: https://github.com/fatcerberus/minisphere/blob/add36a2baacab6f697ba30054484b3f84ed89ead/src/minisphere/game.c#L544-L546If the input path is absolute, the function returns early without attempting to relativize the path at all. Because of this, when passed an absolute path as input,
FS.relativePath
will always return the input path verbatim, even if the paths share a common prefix.This is not a high-priority fix as it only affects games using the
relaxed
ornone
sandboxing modes.full
sandboxing (the default and recommended mode) doesn't allow use of absolute paths at all and is therefore unaffected by this bug.