Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#9 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Documentación
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
linux, python

Línea de trabajo

Empieza examinando las acciones de AptKit PolicyKit mencionadas en el issue: org.aptkit.install-or-remove-packages, org.aptkit.install-purchased-packages y org.aptkit.upgrade-packages. Determina si sus variables de autorización contienen nombres de paquetes y, a continuación, documenta los nombres de las variables o indica claramente que no está disponible la coincidencia a nivel de paquete.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Python
Estrellas
15
Forks
10
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de linuxmint/aptkit

Todos los issues de linuxmint/aptkit

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.