Skip to content

fix(settings): reject empty app password names - #65762

Open
MarioPym wants to merge 3 commits into
nextcloud:masterfrom
MarioPym:fix/reject-empty-app-password-name
Open

MarioPym wants to merge 3 commits into
nextcloud:masterfrom
MarioPym:fix/reject-empty-app-password-name

Conversation

@MarioPym

Copy link
Copy Markdown

Summary

An app password can be renamed to an empty or whitespace-only name: the request returns 200 and the token is saved without a visible name in the list. On creation, an empty name is already rejected, but a whitespace-only name is accepted.

update() now returns 400 when the new name is empty after trimming, before anything is changed, so the frontend shows its existing error and restores the previous name. Tokens that already have an empty name can still change their filesystem scope, since the check only applies when the name changes. create() now also treats a whitespace-only name as empty and keeps the existing 503 response.

How to test

  1. Go to Personal settings → Security → Devices & sessions and create an app password
  2. Rename it to an empty name or to a few spaces
  3. Before: the request returns 200 and the name is saved blank. After: it returns 400, an error is shown and the previous name is kept

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@MarioPym
MarioPym requested a review from a team as a code owner October 21, 2026 16:44
@MarioPym
MarioPym requested review from Altahrim, come-nc, icewind1991 and leftybournes and removed request for a team October 21, 2026 16:44
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
@MarioPym
MarioPym force-pushed the fix/reject-empty-app-password-name branch from 5ee1239 to 36a213b Compare October 30, 2026 21:07
@MarioPym

Copy link
Copy Markdown
Author

Rebased onto master to resolve the conflict with the TokenScopes changes in update(). The fix itself is unchanged.

@come-nc come-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn’t we trim the name at the beginning then, to forbid confusing spaces at start&end ?

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
@MarioPym

MarioPym commented Nov 2, 2026

Copy link
Copy Markdown
Author

Shouldn’t we trim the name at the beginning then, to forbid confusing spaces at start&end ?

Good point, done. The name is now trimmed on create and on rename. On update it's only trimmed when the name actually changes, so existing tokens whose names already have surrounding spaces aren't renamed when only the scope is changed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants