rootwrap RegExFilter doesn't work if a ',' (comma) is part of regex

Bug #1822668 reported by Deepak Tiwari
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.rootwrap
New
Undecided
Unassigned

Bug Description

If a regex is required to have a comma ',' also, as part of rootwrap regex filter (for ex. [0-9-,]*) then it doesn't work. It seems oslo-rootwrap code parses a comma as a parameter separator. Using a '\' as escape doesn't work either....

ubuntu@u1604:~$ cat /etc/taas/rootwrap.d/taas.filter
[Filters]
i40e_sysfs_command: RegExpFilter, i40e_sysfs_command, root, i40e_sysfs_command, (?i)(add|rem), [0-9-,]*, (\/home\/ubuntu\/sys\/class\/net\/.*?\/device\/sriov\/[0-9]+\/(vlan|egress|ingress)_mirror)

ubuntu@u1604:~$ i40e.wrap i40e_sysfs_command add 0-4095 /home/ubuntu/sys/class/net/ensp3s9/device/sriov/99/vlan_mirror
+ sudo /usr/local/bin/taas-rootwrap /etc/taas/rootwrap.conf i40e_sysfs_command add 0-4095 /home/ubuntu/sys/class/net/ensp3s9/device/sriov/99/vlan_mirror
/usr/local/bin/taas-rootwrap: Unauthorized command: i40e_sysfs_command add 0-4095 /home/ubuntu/sys/class/net/ensp3s9/device/sriov/99/vlan_mirror (no filter matched)

If comma is removed (for ex. [0-9-]*), then it works fine:-

ubuntu@u1604:~$ cat /etc/taas/rootwrap.d/taas.filter
[Filters]
i40e_sysfs_command: RegExpFilter, i40e_sysfs_command, root, i40e_sysfs_command, (?i)(add|rem), [0-9-]*, (\/home\/ubuntu\/sys\/class\/net\/.*?\/device\/sriov\/[0-9]+\/(vlan|egress|ingress)_mirror)

ubuntu@u1604:~$ i40e.wrap i40e_sysfs_command add 0-4095 /home/ubuntu/sys/class/net/ensp3s9/device/sriov/99/vlan_mirror
+ sudo /usr/local/bin/taas-rootwrap /etc/taas/rootwrap.conf i40e_sysfs_command add 0-4095 /home/ubuntu/sys/class/net/ensp3s9/device/sriov/99/vlan_mirror

description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.