2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 01:57:43 +00:00

8260 Commits

Author SHA1 Message Date
Georgia Garcia
95d7f37520 coverity: remove log retrieving step temporarily
Right now coverity is running in two steps, one to collect logs in
case of failures, and a different one to actually send the data to
coverity. The log collection step is failing because when collecting
data for python with the new version of coverity, build-log.txt is not
generated.

The whole way we build with coverity might need changing, but
currently this patch is removing the log collection so the pipeline
passes.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-07-31 13:02:07 -03:00
John Johansen
c54c4a7e01 Merge coverity: fix deprecated uses of --no-command and --fs-capture-search
According to the coverity documentation [1], filesystem capture is no
longer supported, favoring the use of the "coverity capture" tool.
This fixes the coverity pipeline which is broken due to flags
--no-command and --fs-capture-search no longer working.

[1] https://documentation.blackduck.com/bundle/coverity-docs-2024.3/page/coverity-analysis/topics/moving_from_filesystem_capture_to_the_coverity_cli.html

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1751
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-31 02:05:06 +00:00
John Johansen
375470144f Merge regression: fix usage statement for linkat_tmpfile
See https://gitlab.com/apparmor/apparmor/-/merge_requests/1743#note_2658749912 for context.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1752
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-31 01:17:17 +00:00
Ryan Lee
73bcf488b2 regression: fix usage statement for linkat_tmpfile
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-07-30 16:35:21 -07:00
Georgia Garcia
117df51e4a coverity: fix deprecated uses of --no-command and --fs-capture-search
According to the coverity documentation [1], filesystem capture is no
longer supported, favoring the use of the "coverity capture" tool.
This fixes the coverity pipeline which is broken due to flags
--no-command and --fs-capture-search no longer working.

[1] https://documentation.blackduck.com/bundle/coverity-docs-2024.3/page/coverity-analysis/topics/moving_from_filesystem_capture_to_the_coverity_cli.html

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-07-30 19:35:25 -03:00
John Johansen
37185f50a4 Merge regression: add test for making O_TMPFILE followed by linkat
The unnamed nature of an O_TMPFILE, combined with the delayed linkage of
linkat(2), creates a potential for a filesystem mediation bypass or other
unexpected file mediation behavior. Thus, add a test to verify whether or
not such a bypass occurs.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1743
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-30 11:09:11 +00:00
John Johansen
b40ac50f49 Merge profiles: add QtWebEngineProcess path used by Arch Linux and other distros
Arch Linux qt6-webengine has `/usr/lib/qt6/QtWebEngineProcess` and
qt5-webengine has `/usr/lib/qt/libexec/QtWebEngineProcess`.

Fedora has `/usr/lib64/qt6/libexec/QtWebEngineProcess`.

openSUSE Tumbleweed has `/usr/libexec/qt5/QtWebEngineProcess` and
`/usr/libexec/qt6/QtWebEngineProcess`.

Co-authored-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1726
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-07-30 08:37:10 +00:00
John Johansen
87e0151c7c Merge added systemd-creds to list of wg-quick binaries
I'd like to store my wg creds in my TPM module using `systemd-creds`:

```bash
PostUp = systemd-creds --name wg0 decrypt /etc/wireguard/secrets/wg0.cred | wg set wg0 private-key /dev/stdin
```

Currently I use `local/wg-quick` as work-around.
The `Ux` permission is may be a little too open, but 2 problems remain:

- the profile maintainer can't know which creds file need to be accessible
- different TMP module implementations / drivers may require different permissions

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1644
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-30 08:34:49 +00:00
Robert Stiller
b9ed931c90 added systemd-creds to list of wg-quick binaries 2025-07-30 08:34:49 +00:00
Maxime Bélair
63ce02c01d Merge logparser: add support for change_onexec logs
Add support for change_onexec logs by converting them to change_profile.
Fix associated test.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1745
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-30 08:27:43 +00:00
Maxime Bélair
e82ee9f4f4 Merge aa-notify: reduce the likelihood of misuses
This MR removes some footguns in aa-notify

- Prevents the modification of special profiles
- Improve the clarity of messages
- Add support for regexes in userns_special_profiles
- Refactor get_event_type.
- Add support for regexes for special profiles
- Optimize aa-notify performances
- Minor bugfixes

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1732
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-30 08:26:50 +00:00
John Johansen
4e8781c2a9 Merge abstractions/mesa, chromium_browser, firefox: Updates
Mesa now needs `~/.cache/mesa_shader_cache_db/marker`.

Chromium wants `/proc/$PID/smaps_rollup`, `/sys/.../report_descriptor`,
and two XDG utilities used by the "Create shortcut..." feature. Deny
the latter for now, due to additional permissions that would be needed
and a questionable security trade-off as a result.

Log excerpts:

`2025-05-14T20:27:27.677404-04:00 darkstar kernel: audit: type=1400 audit(1747268847.675:1994528): apparmor="DENIED" operation="mknod" class="file" profile="chromium_browser" name="/home/skunk/.cache/mesa_shader_cache_db/marker" pid=679258 comm="chromium" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000`

`2025-05-20T15:49:58.039124-04:00 darkstar kernel: [646649.154759] audit: type=1400 audit(1747770598.031:5066099): apparmor="DENIED" operation="open" profile="chromium_browser" name="/proc/98171/smaps_rollup" pid=98171 comm="MemoryInfra" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000`

`2025-04-25T05:02:38.776915-04:00 darkstar kernel: [2275912.763394] audit: type=1400 audit(1745571758.762:151): apparmor="DENIED" operation="open" profile="chromium_browser" name="/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.4/2-6.4:1.0/0003:046D:C31C.0002/report_descriptor" pid=469739 comm="ThreadPoolForeg" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0`

`2025-05-20T17:40:38.775057-04:00 darkstar kernel: [653289.888358] audit: type=1400 audit(1747777238.768:5122686): apparmor="DENIED" operation="exec" profile="chromium_browser" name="/usr/bin/xdg-desktop-menu" pid=116168 comm="ThreadPoolForeg" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0`

`2025-05-20T17:40:38.906998-04:00 darkstar kernel: [653290.020797] audit: type=1400 audit(1747777238.900:5122687): apparmor="DENIED" operation="exec" profile="chromium_browser" name="/usr/bin/xdg-icon-resource" pid=116169 comm="ThreadPoolForeg" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0`

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1698
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-29 20:39:24 +00:00
Maxime Bélair
9ac6047f6c aa-notify: Explicitly import tkinter.font
import tkinter does not automatically import tkinter.font so calls to
the latter fail if the execution environment does not already contains
it.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-29 13:14:18 -07:00
Maxime Bélair
73f4f650e7 aa-notify: Reduce profiles updates to reduce overhead.
Profiles are now updated only at initialization and when aa-notify
itself updates a profile.

A future MR will come to read profiles individually only when an event
for this profile comes to reduce overhead, as more and more profiles are
created.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-29 13:14:18 -07:00
Maxime Bélair
12e3557896 aa-notify: Support regexes in userns_special_profiles
It is now possible to use regexes to define special profiles. unpriv_.*
is used by default.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-29 13:14:18 -07:00
Maxime Bélair
d8c57da6ba Allow aa-notify to use the priority mechanism
Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-29 13:14:18 -07:00
Maxime Bélair
4de3b64e52 Add tests for get_event_type
Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-29 13:14:18 -07:00
Maxime Bélair
71a71e0fa7 Create get_event_type instead of customized_message['userns']['cond']
This improves the code readability

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-29 13:14:18 -07:00
Daniel Richard G.
36d32a81a2 abstractions/mesa, chromium_browser, firefox: Updates
Mesa now needs ~/.cache/mesa_shader_cache_db/marker .

Chromium wants uid_map readable, /proc/$PID/smaps_rollup,
/sys/.../report_descriptor, and two XDG utilities used by the "Create
shortcut..." feature. Deny the latter for now, due to additional
permissions that would be needed and a questionable security trade-off
as a result.

Firefox wants a socket for its crash helper, product_{name,sku} from
DMI devices, and .sql files in its cache directory. It also wants
uevent from devices more broadly than currently allowed.
2025-07-29 15:22:37 -04:00
John Johansen
84fbd87334 Merge profiles: fusermount3 profile fixes for libfuse 3.17
After an upgrade to libfuse 3.17.1-rc0, autopkgtests started to fail
due to a missing x permission for /usr/bin/mount. After looking at the
source code for fusermount, I noticed that it does call /bin/mount and
/bin/umount in certain cases. These uses were already there in
previous versions of libfuse but I'm still not sure why it hasn't
triggered before.

To reproduce it:
```
sudo autopkgtest-buildvm-ubuntu-cloud -v -r questing
autopkgtest archivemount -U --apt-pocket=proposed=src:fuse3 --shell-fail -- qemu autopkgtest-questing-amd64.img
```

After the test fails, enter the vm by
```
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 10022 ubuntu@localhost
```

You can reproduce the test by running
```
cd /tmp/autopkgtest.*/build.*/src/
/tmp/autopkgtest.*/build.*/src/debian/tests/test
```

Note that ix for mount and umount were enough to make the autopkgtest
failures to start passing, but there could be issues in the future
regarding the use of fs specific mount binaries like
/usr/sbin/mount.fuse


Fixes: http://bugs.launchpad.net/bugs/2111845
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1716
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-29 09:08:31 +00:00
Georgia Garcia
e757ca8e14 Merge parser/variables: fix read-after-free in error case
When variable expansion occurs, the expansion attempts to replace the
memory location of the string containing the variable, and frees the
string it is replacing. However, this occurs before the variable lookup
occurs to determine if there is an appropriate declaration for the
variable. When the failing expansion occurs in a profile name, this
causes a read-after-free (followed by a double free) because the error
handling path attempts to report the profile name in the error message.

This can be reproduced like so, using the
tst/simple_tests/vars/vars_profile_name_23.sd testcase:

```
$ ../apparmor_parser --config-file=./parser.conf -M features_files/features.all -S -I /home/sbeattie/git/apparmor/parser/tst/./simple_tests/ ./simple_tests/vars/vars_profile_name_23.sd
Failed to find declaration for: @{FOO}
ERROR expanding variables for profile #xQV, failed to load
free(): double free detected in tcache 2
```

Fix this by waiting to free the profile name field until after the
variable declaration has successfully been looked up. This results in
the test case reporting the following error:

```
$ ../apparmor_parser --config-file=./parser.conf -M features_files/features.all -S -I /home/sbeattie/git/apparmor/parser/tst/./simple_tests/ ./simple_tests/vars/vars_profile_name_23.sd
Failed to find declaration for: @{FOO}
ERROR expanding variables for profile /does/not/exist@{FOO}, failed to load

```

Signed-off-by: Steve Beattie <steve@nxnw.org>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1747
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-07-25 09:42:38 -03:00
Steve Beattie
6673be07aa
parser/variables: fix read-after-free in error case
When variable expansion occurs, the expansion attempts to replace the
memory location of the string containing the variable, and frees the
string it is replacing. However, this occurs before the variable lookup
occurs to determine if there is an appropriate declaration for the
variable. When the failing expansion occurs in a profile name, this
causes a read-after-free (followed by a double free) because the error
handling path attempts to report the profile name in the error message.

This can be reproduced like so, using the
tst/simple_tests/vars/vars_profile_name_23.sd testcase:

```
$ ../apparmor_parser --config-file=./parser.conf -M features_files/features.all -S -I /home/sbeattie/git/apparmor/parser/tst/./simple_tests/ ./simple_tests/vars/vars_profile_name_23.sd
Failed to find declaration for: @{FOO}
ERROR expanding variables for profile #xQV, failed to load
free(): double free detected in tcache 2
```

Fix this by waiting to free the profile name field until after the
variable declaration has successfully been looked up. This results in
the test case reporting the following error:

```
$ ../apparmor_parser --config-file=./parser.conf -M features_files/features.all -S -I /home/sbeattie/git/apparmor/parser/tst/./simple_tests/ ./simple_tests/vars/vars_profile_name_23.sd
Failed to find declaration for: @{FOO}
ERROR expanding variables for profile /does/not/exist@{FOO}, failed to load

```

Fixes: dfbd2dc4b ("parser: refactor variables and symbols table into their own class")
Signed-off-by: Steve Beattie <steve@nxnw.org>
Ref: https://gitlab.com/apparmor/apparmor/-/merge_requests/1747
2025-07-24 23:37:24 -07:00
Ryan Lee
d3a49ff566 regression: add linkat_tmpfile test to task.yaml
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-07-24 08:45:16 -07:00
Ryan Lee
3e7ddc1ce5 regression: add test for making O_TMPFILE followed by linkat
The unnamed nature of an O_TMPFILE, combined with the delayed linkage of
linkat(2), creates a potential for a filesystem mediation bypass. Thus,
add a test to verify whether or not such a bypass occurs.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-07-24 08:45:16 -07:00
Maxime Bélair
2448655188 logparser: add support for change_onexec logs
Add support for change_onexec logs by converting it to change_profile.
Fix associated test.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-24 13:32:13 +02:00
John Johansen
49cb0fe248 Merge profiles: fix regex for hex PCI BDFs
The current lsblk profile contains `@{sys}/devices/pci@{int}:@{int}/** r` (where `@{int}` expands to `[0-9]+`). PCI BDFs are in hex, so block device paths whose BDF contains [a-f] digits are skipped, causing them to be omitted from the output of lsblk.

Replacing `@{int}` with `@{hex}` (which expands to `[0-9a-fA-F]+`) ensures PCI block device paths with [a-f] hex digits are correctly matched and displayed in the output of `lsblk`.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1725
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-07-24 10:46:00 +00:00
John Johansen
ab46c224cb Merge Move annoying "skipping disabled profile" log to debug.
Those messages appear in various context and do not provide any useful feedback to the user, diverging from UNIX philosophy of staying quiet when there's nothing of importance to say.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1738
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-24 10:44:49 +00:00
Keifer Snedeker
b6ad58bbbe profiles: make /sys/devices PCI paths hex-aware 2025-07-23 19:01:25 -04:00
John Johansen
520db7a16c Merge abstractions/X: allow reading /usr/share/xkeyboard-config-*/
/usr/share/X11/xkb/ was moved to /usr/share/xkeyboard-config-2/ in
xkeyboard-config 2.45, see
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/ChangeLog.md?ref_type=heads#breaking-changes-2

The old location was covered by the /usr/share/X11/** rule.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1246743

I propose this fix for 4.x and master. (Users of older AppArmor versions probably don't upgrade their xkeyboard package.)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1741
Approved-by: Alex <alexandre@pujol.io>
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-23 11:13:06 +00:00
John Johansen
a966eac143 Merge lsblk: allow access to PCI buses with hex chars
Hi,

This fixes the following error when a block device's PCI bus starts with
a non-decimal hex character and `lsblk /dev/nvme2n1` is executed:
```
audit: type=1400 audit(1751394406.516:554): apparmor="DENIED" operation="open" class="file" profile="lsblk" name="/sys/devices/pci0000:a0/0000:a0:01.1/0000:a1:00.0/nvme/nvme2/nvme2n1/" pid=164652 comm="lsblk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```
I used hex4 and hex2 as it matches the example from
https://docs.kernel.org/PCI/sysfs-pci.html and also because lspci(8)
says:
> domains are numbered from 0 to ffff
>
> bus (0 to ff)

Bug: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2111604

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1729
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2025-07-23 11:12:10 +00:00
John Johansen
6841df4fe3 Merge utils: Fix priority checking for is_covered
MR !1735 mistakenly assumed that x.is_covered(y) means "x is covered by
y" when the opposite is true

Fix the logic of is_covered and associated tests.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1739
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2025-07-23 09:48:35 +00:00
John Johansen
7fbbf791d3 Merge parser: fix coverity issues
Fix issues introduced in coverity's snapshot 89167 in !1711

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1740
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-23 09:45:12 +00:00
nl6720
f1773f4083
profiles: add QtWebEngineProcess path used by Arch Linux and other distros
Arch Linux qt6-webengine has `/usr/lib/qt6/QtWebEngineProcess` and
qt5-webengine has `/usr/lib/qt/libexec/QtWebEngineProcess`.

Fedora has `/usr/lib64/qt6/libexec/QtWebEngineProcess`.

openSUSE Tumbleweed has `/usr/libexec/qt5/QtWebEngineProcess` and
`/usr/libexec/qt6/QtWebEngineProcess`.

Co-authored-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-23 09:31:02 +03:00
Christian Boltz
238221f379
abstractions/X: allow reading /usr/share/xkeyboard-config-*/
/usr/share/X11/xkb/ was moved to /usr/share/xkeyboard-config-2/ in
xkeyboard-config 2.45, see
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/ChangeLog.md?ref_type=heads#breaking-changes-2

The old location was covered by the /usr/share/X11/** rule.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1246743
2025-07-18 23:00:42 +02:00
Georgia Garcia
efb13aac0a parser: fix leaks from variable refactoring
Fix issues introduced in coverity's snapshot 89167
- CID 532796: (#4 of 4): Resource leak (RESOURCE_LEAK)

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-07-18 14:56:29 -03:00
Georgia Garcia
e4f3ef72ab parser: use const auto & to avoid copy
Fix issues introduced in coverity's snapshot 89167
- CID 532797: (#1 of 1): Use of auto that causes a copy (AUTO_CAUSES_COPY)

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-07-18 14:56:29 -03:00
Georgia Garcia
69c248a431 parser: initialize non-static variable
Fix issues introduced in coverity's snapshot 89167
- CID 532798: (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-07-18 14:15:38 -03:00
John Johansen
ad16a5c5c0 Merge parser: refactor variables and symbols table into their own class
While symtab for now has only static members, it will allow for a
change in the future for each profile to have their own symbols like
profile_name, etc.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1711
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-07-17 23:08:39 +00:00
Maxime Bélair
380dbb84b8 utils: Fix priority checking for is_covered
MR !1735 mistakenly assumed that x.is_covered(y) means "x is covered by
y" when the opposite is true

Fix the logic of is_covered and associated tests.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-17 11:00:24 +02:00
Jérôme Poulin
000b56a323
Move annoying "skipping disabled profile" log to debug.
Signed-off-by: Jérôme Poulin <jeromepoulin@gmail.com>
2025-07-16 16:33:08 -04:00
Christian Boltz
630fd1c285 Merge utils: Improve rule priority support in is_covered/is_equal
- `is_covered` was not checking priorities when checking if a rule is
  covered. With this fix, a rule of lower priority can no longer cover a
  higher priority one.
- Fixes `is_equal(strict=False)` so that `priority=0` matches implicit
  priority (as it is defaulted to zero)
    
Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1735
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-07-16 12:32:26 +00:00
Maxime Bélair
f78aa36547 Add tests for priority is_covered/is_equal fix
Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-16 12:13:41 +00:00
Maxime Bélair
ab9d359405 utils: Improve rule priority support in is_covered/is_equal
- `is_covered` was not checking priorities when checking if a rule is
  covered. With this fix, a rule of lower priority can no longer cover a
  higher priority one.
- Fixes `is_equal(strict=False)` so that priority=0 matches implicit
  priority (as it is defaulted to zero)

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-07-16 12:13:41 +00:00
Christian Boltz
1c2f3582fe Merge Unify get_directory_contents(), and delete unused copy
Copy the optimized version from common.py to easyprof.py (shouldn't
change the behaviour).

Since get_directory_contents() is only used in easyprof.py, delete the
unused copy from common.py.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1720
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-07-15 21:49:48 +00:00
Christian Boltz
ccf74a7d0c Unify get_directory_contents(), and delete unused copy
Copy the optimized version from common.py to easyprof.py (shouldn't
change the behaviour).

Since get_directory_contents() is only used in easyprof.py, delete the
unused copy from common.py.
2025-07-15 19:16:30 +00:00
Christian Boltz
1c9dc33949 Merge Split test classes
Create separate classes for tests not fitting under *TestParseInvalid

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1736
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-07-15 19:00:26 +00:00
Christian Boltz
9696d9e13f
test-mount: move some tests to MountTestIsEqual
... and rename some other tests so that their name matches better what
they do.
2025-07-15 20:36:53 +02:00
Christian Boltz
a833528f36
Split test classes
Create separate classes for tests not fitting under *TestParseInvalid
2025-07-15 20:34:33 +02:00
Christian Boltz
b2bfde5af0 Merge Introduce AATest.parseInvalidRule()
... and change all *TestParseInvalid classes to use it, instead of
having (nearly) the same function in every test-*.py.

Also move tests not matching the rule regex into tests array (which now supports this case).

While at it, enable the tests for abi and include rules.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1728
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-07-15 18:31:00 +00:00
Christian Boltz
fc636c7ff3 Merge Profiles: dovecot add access for dovecot 2.4 doveconf paths
Dovecot 2.4 now creates a "binary" version of its config via doveconf. This needs new access rules, as it otherwise prevents all Dovecot processes from accessing this new configuration.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1733
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-07-15 18:15:56 +00:00