[PR #724] [MERGED] fix: ensure user inputs are normalized #655

Closed
opened 2025-10-09 16:54:32 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/724
Author: @ItalyPaleAle
Created: 7/6/2025
Status: Merged
Merged: 7/13/2025
Merged by: @kmendell

Base: mainHead: unorm


📝 Commits (9)

📊 Changes

23 files changed (+350 additions, -58 deletions)

View changed files

📝 backend/go.mod (+7 -7)
📝 backend/go.sum (+16 -16)
📝 backend/internal/bootstrap/db_bootstrap.go (+2 -0)
📝 backend/internal/controller/api_key_controller.go (+1 -1)
📝 backend/internal/controller/app_config_controller.go (+1 -1)
📝 backend/internal/controller/custom_claim_controller.go (+2 -2)
📝 backend/internal/controller/user_controller.go (+5 -5)
📝 backend/internal/controller/user_group_controller.go (+2 -2)
📝 backend/internal/dto/api_key_dto.go (+2 -2)
📝 backend/internal/dto/app_config_dto.go (+1 -1)
📝 backend/internal/dto/custom_claim_dto.go (+2 -2)
backend/internal/dto/dto_normalize.go (+94 -0)
backend/internal/dto/dto_normalize_test.go (+84 -0)
📝 backend/internal/dto/oidc_dto.go (+1 -1)
📝 backend/internal/dto/user_dto.go (+12 -10)
📝 backend/internal/dto/user_group_dto.go (+2 -2)
📝 backend/internal/service/ldap_service.go (+8 -6)
backend/internal/utils/sqlite/sqlite_util.go (+51 -0)
📝 backend/internal/utils/testing/database.go (+5 -0)
backend/resources/migrations/postgres/20250705000000_normalize.down.sql (+1 -0)

...and 3 more files

📄 Description

User inputs such as names can contain UTF-8 sequences, and they may not be in a normalized form, so they may not show up as identical when they should be.

This PR makes sure that all strings that are not identifiers (like UUIDs) are normalized before being stored in the database.

For more info on Unicode normalization, you can refer to this article I wrote a few years ago


🔄 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/pocket-id/pocket-id/pull/724 **Author:** [@ItalyPaleAle](https://github.com/ItalyPaleAle) **Created:** 7/6/2025 **Status:** ✅ Merged **Merged:** 7/13/2025 **Merged by:** [@kmendell](https://github.com/kmendell) **Base:** `main` ← **Head:** `unorm` --- ### 📝 Commits (9) - [`658f76a`](https://github.com/pocket-id/pocket-id/commit/658f76acf2c56beca56cb5f86c12b09c45110d83) fix: ensure user inputs are normalized - [`b9e9923`](https://github.com/pocket-id/pocket-id/commit/b9e992352e536e73c26ac0c697a31619c544eec3) Fix unit tests - [`e41b7a3`](https://github.com/pocket-id/pocket-id/commit/e41b7a313f5086599758613fc2d08dd5dbf285ac) Merge branch 'main' into unorm - [`5f12952`](https://github.com/pocket-id/pocket-id/commit/5f12952d8e43f88f1e9b8f78193414c51687c826) Merge branch 'main' of https://github.com/pocket-id/pocket-id into unorm - [`623f316`](https://github.com/pocket-id/pocket-id/commit/623f3169f09e44414267d24629099cb43e800f00) Merge branch 'main' into unorm - [`6de09b7`](https://github.com/pocket-id/pocket-id/commit/6de09b7ff7c478b7db7a59b4f0e6f81a72482093) Use a custom ShouldBindWithNormalizedJSON method - [`c11a3ef`](https://github.com/pocket-id/pocket-id/commit/c11a3ef1db78c8ba6a21427d40fc6c4e65615882) Merge branch 'main' of https://github.com/pocket-id/pocket-id into unorm - [`79e6260`](https://github.com/pocket-id/pocket-id/commit/79e62607f3535cde54ab9abb0fe3db0a23a3c6c1) Missing these files - [`1e1b2c2`](https://github.com/pocket-id/pocket-id/commit/1e1b2c2c616f1db64fffff3207cfe22b59297c0a) Merge branch 'main' into unorm ### 📊 Changes **23 files changed** (+350 additions, -58 deletions) <details> <summary>View changed files</summary> 📝 `backend/go.mod` (+7 -7) 📝 `backend/go.sum` (+16 -16) 📝 `backend/internal/bootstrap/db_bootstrap.go` (+2 -0) 📝 `backend/internal/controller/api_key_controller.go` (+1 -1) 📝 `backend/internal/controller/app_config_controller.go` (+1 -1) 📝 `backend/internal/controller/custom_claim_controller.go` (+2 -2) 📝 `backend/internal/controller/user_controller.go` (+5 -5) 📝 `backend/internal/controller/user_group_controller.go` (+2 -2) 📝 `backend/internal/dto/api_key_dto.go` (+2 -2) 📝 `backend/internal/dto/app_config_dto.go` (+1 -1) 📝 `backend/internal/dto/custom_claim_dto.go` (+2 -2) ➕ `backend/internal/dto/dto_normalize.go` (+94 -0) ➕ `backend/internal/dto/dto_normalize_test.go` (+84 -0) 📝 `backend/internal/dto/oidc_dto.go` (+1 -1) 📝 `backend/internal/dto/user_dto.go` (+12 -10) 📝 `backend/internal/dto/user_group_dto.go` (+2 -2) 📝 `backend/internal/service/ldap_service.go` (+8 -6) ➕ `backend/internal/utils/sqlite/sqlite_util.go` (+51 -0) 📝 `backend/internal/utils/testing/database.go` (+5 -0) ➕ `backend/resources/migrations/postgres/20250705000000_normalize.down.sql` (+1 -0) _...and 3 more files_ </details> ### 📄 Description User inputs such as names can contain UTF-8 sequences, and they may not be in a normalized form, so they may not show up as identical when they should be. This PR makes sure that all strings that are not identifiers (like UUIDs) are normalized before being stored in the database. > For more info on Unicode normalization, you can refer to [this article](https://withblue.ink/2019/03/11/why-you-need-to-normalize-unicode-strings.html) I wrote a few years ago --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-09 16:54:32 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id-pocket-id-2#655