![]() |
Solved CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +--- Thread: Solved CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks (/showthread.php?tid=366338) |
CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - jfly - 2022-01-05 I recently dug into this NixOS issue where the Kodi web interface was returning a "File not found" message rather than the chorus2 interface: https://github.com/NixOS/nixpkgs/issues/145116. The problem ended up being related to how NixOS installs kodi addons: it create a "wrapper" for kodi that sets up a `KODI_HOME`. I'm happy to explain all the details if necessary, but the short version of the story is that on my machine, kodi ends up running with a KODI_HOME that looks like this:
I've truncated the output, but hopefully it's obvious how everything here is a symlink, except for `webinterface.default`, which is a regular folder because of this "hack" I just got merged up to NixOS. (This doesn't feel like the right long term solution because it special cases webinterface.default, and therefore is not going to handle other addons.) If the webinterface.default ends up being a symlink, then CFileUtils::CheckFileAccessAllowed ends up denying access because the realpath of files inside that folder are *not* underneath any of the whitelist paths (specifically, "special://xbmc" in this case). Would y'all be open to some sort of change to kodi to let this work on NixOS? Some ideas: 1. Kodi could expose some hook to add entries into this whitelist. 2. Kodi could expose some option to "dangerously" turn off this call to realpath. This might be analogous to apache's FollowSymLinks option, although I'm not fully grok-ing the docs on it. It is interesting to note that maybe the call to realpath isn't actually protecting us from much. From the apache docs: Quote:Omitting this option should not be considered a security restriction, since symlink testing is subject to race conditions that make it circumventable. Thanks in advance! Kodi is a wonderful piece of software. RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - wsnipex - 2022-01-05 I'm not familiar with how nixOS packaging works, but it certainly seems particular. I suggest but simply add a patch to your packaging, adding the path to the whitelist. RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - aanderse - 2022-01-06 Thanks for the feedback @wsnipex. Is there any chance Team Kodi would accept a patch to allow adding paths to the whitelist, even if at build time? Always a bonus if NixOS doesn't have to maintain separate patches against upstream. RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - wsnipex - 2022-01-06 I would be ok with adding a build time cmake option RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - aanderse - 2022-01-07 Great! Thank you very much @wsnipex! We'll take this back, work something out, and then ping you in a PR. Much appreciated. RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - jfly - 2022-03-12 I found some time today to put together a RFC: https://github.com/xbmc/xbmc/pull/21113. Hopefully the idea makes sense! RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - wsnipex - 2022-03-26 fix merged, so marking this as solved RE: CFileUtils::CheckFileAccessAllowed web interface issues with how NixOS uses symlinks - jfly - 2022-03-26 Thanks, wsnipex! |