mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5610] [MERGED] fix(settings): require re-2FA confirmation for sensitive setting changes #5928
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5928
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5610
Author: @n0ctal
Created: 6/27/2026
Status: ✅ Merged
Merged: 6/28/2026
Merged by: @MHSanaei
Base:
main← Head:pr-2fa-sensitive-settings📝 Commits (5)
b138d05fix(settings): require server-side 2fa for sensitive changes6d15f81Merge branch 'main' into pr-2fa-sensitive-settingsa23e6f3Merge branch 'main' into pr-2fa-sensitive-settingsb31afdbMerge branch 'main' into pr-2fa-sensitive-settings92867d1fix(lint): group third-party imports separately from local (goimports)📊 Changes
7 files changed (+97 additions, -23 deletions)
View changed files
📝
frontend/src/api/queries/useAllSettings.ts(+9 -4)📝
frontend/src/pages/settings/SecurityTab.tsx(+21 -9)📝
frontend/src/pages/settings/SettingsPage.tsx(+2 -1)📝
frontend/src/test/api-token-date.test.tsx(+1 -1)📝
internal/web/controller/setting.go(+23 -6)📝
internal/web/service/setting.go(+20 -2)📝
internal/web/service/setting_security_test.go(+21 -0)📄 Description
Summary
When two-factor auth is enabled, changing sensitive settings did not require a fresh 2FA confirmation. This adds a server-side re-2FA check on sensitive setting mutations, with the corresponding Security-tab UX.
Why
A hijacked session (or an unattended logged-in panel) could alter security-relevant settings without re-asserting the second factor. Gating sensitive changes on a fresh 2FA code restores the second-factor guarantee for the actions that matter most.
Scope
internal/web/service/setting.go+internal/web/controller/setting.go: server-side 2FA requirement on sensitive setting changes (server-side enforced, not just UI).frontend/src/pages/settings/SecurityTab.tsx(+ SettingsPage / useAllSettings): prompt for the 2FA code on those changes.internal/web/service/setting_security_test.go: coverage.Validation
go test ./internal/web/servicepasses.Risk
Low. Only adds a confirmation gate; non-sensitive settings and 2FA-disabled setups are unaffected.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.