mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Limit permission and selfservice names to alphanumerics, -, _, space
The DN and ACI code doesn't always escape special characters properly. Rather than trying to fix it, this patch takes the easy way out and enforces that the names are safe. https://fedorahosted.org/freeipa/ticket/2585
This commit is contained in:
committed by
Rob Crittenden
parent
35f44a1aeb
commit
6e5c8b25bf
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import copy
|
||||
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import api, _, ngettext
|
||||
from ipalib import Flag, Str, StrEnum
|
||||
@@ -92,6 +93,7 @@ output_params = (
|
||||
|
||||
dn_ipaconfig = str(DN('cn=ipaconfig,cn=etc,%s' % api.env.basedn))
|
||||
|
||||
|
||||
def check_attrs(attrs, type):
|
||||
# Trying to delete attributes - no need for validation
|
||||
if attrs is None:
|
||||
@@ -154,6 +156,8 @@ class permission(LDAPObject):
|
||||
cli_name='name',
|
||||
label=_('Permission name'),
|
||||
primary_key=True,
|
||||
pattern='^[-_ a-zA-Z0-9]+$',
|
||||
pattern_errmsg="May only contain letters, numbers, -, _, and space",
|
||||
),
|
||||
Str('permissions+',
|
||||
cli_name='permissions',
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import copy
|
||||
|
||||
from ipalib import api, _, ngettext
|
||||
from ipalib import Flag, Str
|
||||
from ipalib.request import context
|
||||
@@ -60,6 +61,7 @@ output_params = (
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class selfservice(Object):
|
||||
"""
|
||||
Selfservice object.
|
||||
@@ -77,6 +79,8 @@ class selfservice(Object):
|
||||
label=_('Self-service name'),
|
||||
doc=_('Self-service name'),
|
||||
primary_key=True,
|
||||
pattern='^[-_ a-zA-Z0-9]+$',
|
||||
pattern_errmsg="May only contain letters, numbers, -, _, and space",
|
||||
),
|
||||
Str('permissions*',
|
||||
cli_name='permissions',
|
||||
|
||||
Reference in New Issue
Block a user