fix: allow pipe character in usernames and names - #2270
Open
rluisr wants to merge 1 commit into
Open
Conversation
IsNameValid rejected '|' along with other Windows-illegal filename characters. On Unix this blocks common OIDC/Auth0 subject formats such as "auth0|..." and "google-oauth2|...", which are widely used as SFTPGo usernames. '|' is a valid path component on Linux/macOS and is not involved in path traversal (already covered by rejecting '/' and '\\'). Keep the remaining Windows-illegal characters restricted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
|inIsNameValidso OIDC/Auth0-style usernames work again: * ? " < >)TestIsNameValidwith Auth0 / Google OAuth2 subject examplesMotivation
IsNameValidrejects characters that are illegal in Windows filenames.|was added in 2f092d1 as part of that set.On Linux/macOS (the common deployment target for SFTPGo containers),
|is a valid path component. It is also the separator used by Auth0 and other OIDC providers in the standard subject format:auth0|<id>google-oauth2|<id>github|<id>Many deployments map the OIDC
subclaim directly to the SFTPGo username. After the|rejection landed, creating or authenticating those users fails validation.|is not a path separator and is not involved in path traversal. Traversal is already prevented by rejecting/and\, plus the edge-level path normalization from 2f092d1.Change
Test plan
auth0|abc123andgoogle-oauth2|xyzexpecttrue: * ? " < > / \remainfalseTestIsNameValidon this PR