From 80d7e33432fc251c951454aa12849019ec0e08e1 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Fri, 25 Sep 2020 23:26:31 -0700 Subject: [PATCH] parser: add dbus path slash filtering equality tests Test to ensure that slash filtering occurs properly in dbus path components. Signed-off-by: Steve Beattie MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/607 Signed-off-by: John Johansen --- parser/tst/equality.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/parser/tst/equality.sh b/parser/tst/equality.sh index 75b8208d6..ddd03cc55 100755 --- a/parser/tst/equality.sh +++ b/parser/tst/equality.sh @@ -263,6 +263,24 @@ verify_binary_equality "dbus minimization found in dbus abstractions" \ peer=(name=org.freedesktop.DBus), dbus send bus=session, }" +# verify slash filtering for dbus paths. +verify_binary_equality "dbus slash filtering for paths" \ + "/t { dbus (send, receive) path=/com/foo, dbus (send, receive) path=/com/bar, }" \ + "/t { dbus (send, receive) path=/com///foo, dbus (send, receive) path=///com/bar, }" \ + "/t { dbus (send, receive) path=/com//{foo,bar}, }" \ + "/t { dbus (send, receive) path={//com/foo,/com//bar}, }" \ + "@{FOO}=/foo + /t { dbus (send, receive) path=/com/@{FOO}, dbus (send, receive) path=/com/bar, }" \ + "@{FOO}=/foo /bar + /t { dbus (send, receive) path=/com/@{FOO}, }" \ + "@{FOO}=/bar //foo + /t { dbus (send, receive) path=/com/@{FOO}, }" \ + "@{FOO}=//{bar,foo} + /t { dbus (send, receive) path=/com/@{FOO}, }" \ + "@{FOO}=/foo + @{BAR}=bar + /t { dbus (send, receive) path=/com/@{FOO}, dbus (send, receive) path=/com//@{BAR}, }" + # Rules compatible with audit, deny, and audit deny # note: change_profile does not support audit/allow/deny atm for rule in "capability" "capability mac_admin" \