-
Notifications
You must be signed in to change notification settings - Fork 140
73 lines (61 loc) · 2.41 KB
/
polkit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
##
## Copyright (c) 2022 Sebastian Pipping <[email protected]>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
name: Check for Polkit policy parse errors
on:
push:
pull_request:
schedule:
- cron: '0 4 * * 5' # Every Friday at 4am
# Drop permissions to minimum for security
permissions:
contents: read
jobs:
polkit_policies:
name: Check for Polkit policy parse errors
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install runtime dependencies
run: |
set -x
sudo apt-get update
sudo apt-get install --no-install-recommends --yes -V expat
- name: Check for Polkit policy parse errors
run: |
# This will work around pkaction exiting with unjustified(?)
# code 1 on Ubuntu 20.04
check_polkit_action() { pkaction -v -a "$1" | tee /dev/stderr | fgrep -q 'implicit any' ; }
set -x
actions=(
org.usbguard.Devices1.listDevices
org.usbguard.Devices1.applyDevicePolicy
org.usbguard.Policy1.appendRule
org.usbguard.Policy1.listRules
org.usbguard.Policy1.removeRule
org.usbguard1.getParameter
org.usbguard1.setParameter
)
# Self-test: Assert that prior to installation, our Polkit "actions"
# are unknown to PolKit.
! check_polkit_action "${actions[0]}"
# Install the policy so that polkin can find it
xmlwf src/DBus/org.usbguard1.policy
sudo cp -v src/DBus/org.usbguard1.policy /usr/share/polkit-1/actions/
# Assert that after installation, all of our Polkit "actions" are known.
# This detects parse error regressions.
for action in "${actions[@]}"; do
check_polkit_action "${action}"
done