Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

What are the Polkit variables utilized by the AptKit PolicyKit actions?

Aperta
#9 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Documentazione
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
linux, python

Direzione di ricerca

Inizia esaminando le azioni AptKit PolicyKit indicate nell’issue: org.aptkit.install-or-remove-packages, org.aptkit.install-purchased-packages e org.aptkit.upgrade-packages. Determina se le loro variabili di autorizzazione contengono nomi di pacchetti, quindi documenta i nomi delle variabili oppure dichiara chiaramente che la corrispondenza a livello di pacchetto non è disponibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
15
Fork
10
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di linuxmint/aptkit

Tutte le issue di linuxmint/aptkit

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.