[PR #1075] [MERGED] Add validation and error/warning messages for attribute names (#1072) #1105

Closed
opened 2026-02-27 09:10:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lldap/lldap/pull/1075
Author: @broeng
Created: 1/13/2025
Status: Merged
Merged: 1/22/2025
Merged by: @nitnelave

Base: mainHead: attr-underscores


📝 Commits (1)

  • 0006ce3 Add validation and error/warning messages for attribute names

📊 Changes

12 files changed (+399 additions, -30 deletions)

View changed files

📝 Cargo.lock (+6 -0)
📝 app/Cargo.toml (+3 -0)
📝 app/src/components/create_group_attribute.rs (+8 -0)
📝 app/src/components/create_user_attribute.rs (+8 -0)
📝 app/src/components/fragments/attribute_schema.rs (+43 -27)
📝 app/src/components/group_schema_table.rs (+1 -1)
📝 app/src/components/user_schema_table.rs (+1 -1)
📝 server/Cargo.toml (+3 -0)
📝 server/src/infra/graphql/mutation.rs (+269 -1)
validation/Cargo.toml (+9 -0)
validation/src/attributes.rs (+45 -0)
validation/src/lib.rs (+3 -0)

📄 Description

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.

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. As this is unfortunately quite a few of the hardcoded attributes, we should probably consider listing other, valid, aliases for the same attributes instead.

Screenshots

Backend rejecting creation through GraphQL API (frontend validation disabled here for the screenshot):

backend_rejection

Frontend rejecting creation of invalid attribute pre-submit:

frontend_rejection

Schema attribute overview showing warnings for potentially problematic attributes:

overview_warnings


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lldap/lldap/pull/1075 **Author:** [@broeng](https://github.com/broeng) **Created:** 1/13/2025 **Status:** ✅ Merged **Merged:** 1/22/2025 **Merged by:** [@nitnelave](https://github.com/nitnelave) **Base:** `main` ← **Head:** `attr-underscores` --- ### 📝 Commits (1) - [`0006ce3`](https://github.com/lldap/lldap/commit/0006ce3dd1f8f2155ab7cdc673db5710f022e454) Add validation and error/warning messages for attribute names ### 📊 Changes **12 files changed** (+399 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+6 -0) 📝 `app/Cargo.toml` (+3 -0) 📝 `app/src/components/create_group_attribute.rs` (+8 -0) 📝 `app/src/components/create_user_attribute.rs` (+8 -0) 📝 `app/src/components/fragments/attribute_schema.rs` (+43 -27) 📝 `app/src/components/group_schema_table.rs` (+1 -1) 📝 `app/src/components/user_schema_table.rs` (+1 -1) 📝 `server/Cargo.toml` (+3 -0) 📝 `server/src/infra/graphql/mutation.rs` (+269 -1) ➕ `validation/Cargo.toml` (+9 -0) ➕ `validation/src/attributes.rs` (+45 -0) ➕ `validation/src/lib.rs` (+3 -0) </details> ### 📄 Description 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. 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. As this is unfortunately quite a few of the hardcoded attributes, we should probably consider listing other, valid, aliases for the same attributes instead. # Screenshots Backend rejecting creation through GraphQL API (frontend validation disabled here for the screenshot): ![backend_rejection](https://github.com/user-attachments/assets/a34773fa-ee29-4c07-bd4b-c989a250f369) Frontend rejecting creation of invalid attribute pre-submit: ![frontend_rejection](https://github.com/user-attachments/assets/466526f4-407e-4815-9241-2645fab49ab7) Schema attribute overview showing warnings for potentially problematic attributes: ![overview_warnings](https://github.com/user-attachments/assets/4f0c3ebc-15d6-4604-92ae-2485df7d74ad) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 09:10:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#1105
No description provided.