server, app: Add validation for attribute names (#1075)

This commit adds support for basic validation of attribute
names at creation, and also in the schema overview. Both
user and group attributes are validated with the same rules.

For now, attribute names will be considered valid, if they
only contain alphanumeric characters and dashes.

Validation has been added the following places:

- In graphql API, for creation of both user and group attributes.
  Request will be rejected, if attribute name is invalid.

- In frontend, before submitting a request to create a new user
  or group attribute. Rejection here will show an error message
  including a list of the invalid characters used.

As this change adds stricter validation to attributes, and, since
the rationale for this is partly compatibility with other LDAP
systems, this change also adds a warning in the schema overviews
to any attribute using invalid characters.
This commit is contained in:
Simon Broeng Jensen
2025-01-22 09:57:47 +01:00
committed by GitHub
parent 31a0cf5a4f
commit f5fbb31e6e
12 changed files with 401 additions and 32 deletions
Generated
+6
View File
@@ -2536,6 +2536,7 @@ dependencies = [
"ldap3_proto",
"lettre",
"lldap_auth",
"lldap_validation",
"log",
"mockall",
"nix",
@@ -2589,6 +2590,7 @@ dependencies = [
"indexmap 1.6.2",
"jwt 0.13.0",
"lldap_auth",
"lldap_validation",
"rand 0.8.5",
"serde",
"serde_json",
@@ -2653,6 +2655,10 @@ dependencies = [
"serde_json",
]
[[package]]
name = "lldap_validation"
version = "0.6.0"
[[package]]
name = "local-channel"
version = "0.1.5"