[apparmor] [patch] [2/9] Add strip_parenthesis() to regex.py

Christian Boltz apparmor at cboltz.de
Fri May 20 23:42:03 UTC 2016


Am Freitag, 20. Mai 2016, 15:58:01 CEST schrieb Seth Arnold:
> > some dbus rule conditionals come with optional parenthesis. Instead
> > of making the regex even more complicated, use a small function to
> > strip those parenthesis.
> >
> > 
> >
> > Also add some tests for strip_parenthesis() to test-regex.py.
> How will this handle '() foo ()' or '(((())))'?

Well, it will strip the outer set of parenthesis, so your example will 
result in ') foo (' and '((()))'.

The "trick" is to use this function only on somewhat defined input which 
was pre-filtered with a regex etc.

Oh, and I'm quite sure if it hits a rule like
    dbus peer=(label=() foo ()),
stripping a set of parenthesis won't make it more broken, just broken in 
a different way ;-)


Christian Boltz
Zwar sind CSS-Bugs kein Alleinstellungsmerkmal des Internet Explorers,
jedoch beansprucht Microsoft seit vielen Jahren die Marktführerschaft.
[Dirk Jesse auf http://www.highresolution.info/spotlight/entry/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160521/11db6884/attachment.pgp>

More information about the AppArmor mailing list