Skip to content

fix: allow pipe character in usernames and names - #2270

Open
rluisr wants to merge 1 commit into
drakkan:mainfrom
rluisr:allow-pipe-in-username
Open

fix: allow pipe character in usernames and names#2270
rluisr wants to merge 1 commit into
drakkan:mainfrom
rluisr:allow-pipe-in-username

Conversation

@rluisr

@rluisr rluisr commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • Allow | in IsNameValid so OIDC/Auth0-style usernames work again
  • Keep rejecting the other Windows-illegal filename characters (: * ? " < >)
  • Extend TestIsNameValid with Auth0 / Google OAuth2 subject examples

Motivation

IsNameValid rejects 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 sub claim 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

- case ':', '*', '?', '"', '<', '>', '|':
+ case ':', '*', '?', '"', '<', '>':

Test plan

  • Unit cases for auth0|abc123 and google-oauth2|xyz expect true
  • Existing rejections for : * ? " < > / \ remain false
  • CI TestIsNameValid on this PR

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.
@rluisr
rluisr requested a review from drakkan as a code owner July 22, 2026 07:33
@CLAassistant

CLAassistant commented Jul 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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