Skip to content

Conversation

@ArielLeyva
Copy link
Contributor

@ArielLeyva ArielLeyva commented Dec 20, 2025

Description

When modifying sensitive user data (such as passwords, executing commands, registering new users, etc.), the authenticated user's password is requested to validate the action.

This only applies if the authentication method is "json" (JSON Web Token). With the "proxy" authentication method, it would require validation that is outside the scope of the Filebrowser backend. It could also apply to the "hook" authentication method, but this could cause confusion for Filebrowser users.

Additional Information

Closes #5213

Checklist

Before submitting your PR, please indicate which issues are either fixed or closed by this PR. See GitHub Help: Closing issues using keywords.

  • I am aware the project is currently in maintenance-only mode. See README
  • I am aware that translations MUST be made through Transifex and that this PR is NOT a translation update
  • I am making a PR against the master branch.
  • I am sure File Browser can be successfully built. See builds and development.

@ArielLeyva ArielLeyva requested a review from a team as a code owner December 20, 2025 14:00
ErrInvalidRequestParams = errors.New("invalid request params")
ErrSourceIsParent = errors.New("source is parent")
ErrRootUserDeletion = errors.New("user with id 1 can't be deleted")
ErrCurrentPasswordIncorrect = errors.New("the current password is incorrect")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error returned when validating the logged-in user's password if validation fails

body: JSON.stringify({
what: "user",
which: [],
current_password: currentPassword,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Send current password entered in the form

body: JSON.stringify({
what: "user",
which: which,
...(currentPassword != null ? { current_password: currentPassword } : {}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Send current password entered in the form (only if it was sent in the argument)

minimumPasswordLength: number;
userHomeBasePath: string;
defaults: SettingsDefaults;
authMethod: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Include authentication type in the settings returned to the frontend to show/hide the "current password" field depending on the authentication type

aceEditorTheme.value = authStore.user.aceEditorTheme;
layoutStore.loading = false;
const { authMethod } = await settings.get();
isCurrentPasswordRequired.value = authMethod == "json";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Display the "current password" field only if the authentication type is JSON

return http.StatusBadRequest, err
}

if d.settings.AuthMethod == auth.MethodJSONAuth {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apply verification if the authentication type is JSON

return http.StatusBadRequest, err
}

if d.settings.AuthMethod == auth.MethodJSONAuth {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apply verification if the authentication type is JSON

}

if d.settings.AuthMethod == auth.MethodJSONAuth {
var sensibleFields = map[string]struct{}{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Define the sensitive fields. If these are sent from the frontend for updating, validation must be applied.

Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

Thank you!

@hacdias hacdias merged commit b8151a0 into filebrowser:master Jan 3, 2026
6 checks passed
@Mask-Vip
Copy link

Mask-Vip commented Jan 6, 2026

After upgrading to the latest version, although you need to confirm the current password again when creating or modifying user information, deleting users still does not require the current password! Deleting users should also be a sensitive operation, right?

@ArielLeyva
Copy link
Contributor Author

After upgrading to the latest version, although you need to confirm the current password again when creating or modifying user information, deleting users still does not require the current password! Deleting users should also be a sensitive operation, right?

Yes, I'll open a PR with this change.

@Mask-Vip
Copy link

Mask-Vip commented Jan 7, 2026

After upgrading to the latest version, although you need to confirm the current password again when creating or modifying user information, deleting users still does not require the current password! Deleting users should also be a sensitive operation, right?

Yes, I'll open a PR with this change.

Thank you very much for your reply and efforts.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Sensitive actions should authenticate with additional security check

3 participants