-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
kpmcore: patch trustedprefixes #191822
kpmcore: patch trustedprefixes #191822
Conversation
a8594c1
to
40bf766
Compare
Wouldn't pushing our paths into the trustedprefixes file also work, since it works with prefixes? |
If I remember correctly no, because then any other application using kpmcore would also need it's /nix/store/xxxxxxxx-program path pushed to the file. But I'll try it again and see |
So for pushing our paths to trustedprefixes file, we would need to path this part of the code
To something maybe like
and then add |
substituteInPlace src/backend/corebackend.cpp \ | ||
--replace /usr/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy $out/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy | ||
substituteInPlace src/util/externalcommandhelper.cpp \ | ||
--replace "(trustedPrefixes.find(prefix.path()) == trustedPrefixes.end())" "(!prefix.path().startsWith(QStringLiteral(\"/nix/store\")) && !prefix.path().startsWith(QStringLiteral(\"/run/current-system/sw\")))" |
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.
I prefer to create a patch file with description for this. It's not quite trivial.
Also isn't allowing everything in /nix/store
insecure? For Nix, allowed-users
are not necessary trusted-users
. So there are some users can build things with nix-daemon but doesn't have root access.
I think we should only allow /run/current-system
if it works. Privileged programs from desktop environments should be installed system-wide.
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.
Unfortunately only allowing /run/current-system
does not work. Not sure how big of a security concern it is though given that trusted prefixes are a recent addition, and root permissions are still needed to actually modify partitions
@oxalica Please review so we can get this in. We need to know if the installer ISO works rather sooner than later. |
IMO adding any I tested in QEMU.
|
Thought it could be since partitionmanager and kpmcore are out of sync in nixpkgs at the moment, but it worked when installed on my laptop, so not sure what that error could be. Are both |
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.
Fine, it works with I rebase this to master.
Description of changes
Adds a patch to kpmcore to fix execution on Nix/NixOS.
Ever since the following commit, kpmcore checks where executions are being called from, and blacklists anything not in
/{bin,sbin}
or/usr/{bin,sbin}
.https://invent.kde.org/system/kpmcore/-/commit/6b260fa84e75944fd15c3fff1a77723086af2038
Things done
Patch the trusted prefix method to check for
/nix/store
or/run/current-system/sw
instead.sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes