What are the Polkit variables utilized by the AptKit PolicyKit actions?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- linux, python
- Domain
- backend, operating-systems
Research direction
Start by examining the AptKit PolicyKit actions named in the issue: org.aptkit.install-or-remove-packages, org.aptkit.install-purchased-packages, and org.aptkit.upgrade-packages. Determine whether their authorization variables contain package names, then document the variable names or clearly state that package-level matching is unavailable.
Written by the indexing model from the issue text.
Description
Modern PolicyKit utilizes JavaScript for authorization rules. The "Action" type supports the "lookup()" method, which is used to lookup the variables passed from the mechanism (in this case AptKit). Regarding package management on our company workstations, we construct rules to prevent users from installing/removing/upgrading certain packages while allowing such actions for other packages. This works very well with the PackageKit, Flatpak, and Synaptic PolicyKit actions - we can use regex to test if the applicable polkit variable contains the name of a package we want to restrict. Thus far we haven't been able to determine what polkit variables the AptKit PolicyKit actions are using.
So, is there someone who can provide the polkit variables used by the actions noted below? That is assuming variables are used and would contain the names of the packages.
org.aptkit.install-or-remove-packages
org.aptkit.install-purchased-packages
org.aptkit.upgrade-packages
For example, here are some trimmed rules that work for PackageKit, Flatpak, and Synaptic:
- PackageKit polkit action variable "package_ids" contains the package name
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.packagekit.package-downgrade" ||
action.id == "org.freedesktop.packagekit.package-install" ||
action.id == "org.freedesktop.packagekit.package-reinstall" ||
action.id == "org.freedesktop.packagekit.package-remove") {
if (RegExp('sssd','i').test(action.lookup("package_ids")) === true ||
RegExp('unattended','i').test(action.lookup("package_ids")) === true ||
RegExp('vnc','i').test(action.lookup("package_ids")) === true)
{
return polkit.Result.NO;
}
else {
return polkit.Result.YES;
}
}
});
- Flatpak polkit action variable "ref" contains the package name
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.Flatpak.app-install" ||
action.id == "org.freedesktop.Flatpak.app-uninstall") {
if (RegExp('torrent','i').test(action.lookup("ref")) === true ||
RegExp('dconf-editor','i').test(action.lookup("ref")) === true ||
RegExp('vnc','i').test(action.lookup("ref")) === true)
{
return polkit.Result.NO;
}
else {
return polkit.Result.YES;
}
}
});
- Synaptic polkit action variable "command_line" contains the package name
polkit.addRule(function(action, subject) {
if (action.id == "com.ubuntu.pkexec.synaptic") {
if (RegExp('linux-image','i').test(action.lookup("command_line")) === true)
{
return polkit.Result.NO;
}
else {
return polkit.Result.YES;
}
}
});
https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html
- Dominant language
- Python
- Stars
- 15
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from linuxmint/aptkit
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in linuxmint/aptkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100