What are the Polkit variables utilized by the AptKit PolicyKit actions?
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- linux, python
调研方向
首先检查 issue 中提到的 AptKit PolicyKit 操作:org.aptkit.install-or-remove-packages、org.aptkit.install-purchased-packages 和 org.aptkit.upgrade-packages。确定其授权变量是否包含软件包名称,然后记录变量名称,或明确说明不支持软件包级匹配。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 15
- 派生
- 10
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
linuxmint/aptkit 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 50/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 35/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#117848 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
zilliztech/memsearch#759 ·