Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SECURITY] Add a name validator matching keycloak constraints #17

Merged
merged 8 commits into from
Oct 4, 2024

Conversation

buchmarv
Copy link
Contributor

@buchmarv buchmarv commented Oct 4, 2024


@buchmarv
Copy link
Contributor Author

buchmarv commented Oct 4, 2024

The regex is derived from https://github.com/keycloak/keycloak/blob/main/services/src/main/java/org/keycloak/userprofile/validator/PersonNameProhibitedCharactersValidator.java#L42 and needed some adjustments as it was not compatible with PCRE.

'null' => [null, true],
'empty string' => ['', true],
'Valid name' => ['Dscherêmy-Pasquàlle Gucci', true],
'Valid name 2' => ['X Æ A-12', true],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you did there.

'Opening square bracket' => ['[Harald', false],
'Closing square bracket' => ['Sieglinde]', false],
'Percent' => ['100% creative', false],
'Exclamation mark' => ['My name\'s not Rick!', false],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed chance: I am Pickle Rick!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, never watched it. 😬

'Exclamation mark' => ['My name\'s not Rick!', false],
'Hash' => ['#Snoop', false],
'Question mark' => ['Am I supposed to put my name in here?', false],
'Paragraph' => ['§ 307 StGB', false],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAS IST LOS MIT DIR 😂

'Semicolon' => ['return true;', false],
'Asterisk' => ['Ein *, der deinen Namen trägt.', false],
'Tilde' => ['~~~oO Andiii Oo~~~', false],
'Pipe' => ['Roddy |er', false],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

@buchmarv buchmarv merged commit 9d6fd68 into master Oct 4, 2024
7 checks passed
@buchmarv buchmarv deleted the security/add-name-validator branch October 4, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants