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

Đang mở
#9 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
linux, python
Lĩnh vực
backend, operating-systems

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra các action AptKit PolicyKit được nêu trong issue: org.aptkit.install-or-remove-packages, org.aptkit.install-purchased-packages và org.aptkit.upgrade-packages. Xác định xem các biến ủy quyền của chúng có chứa tên gói hay không, sau đó ghi lại tên các biến hoặc nêu rõ rằng việc đối sánh ở cấp gói không khả dụng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
15
Fork
10
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của linuxmint/aptkit

Tất cả issue của linuxmint/aptkit

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.