mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6459] [MERGED] fix(api): return 401 for invalid Bearer token instead of 404 #6281
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#6281
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/6459
Author: @mrchatam
Created: 9/11/2026
Status: ✅ Merged
Merged: 9/12/2026
Merged by: @MHSanaei
Base:
main← Head:fix/bearer-invalid-401📝 Commits (1)
d19c42cfix(api): return 401 for invalid Bearer token instead of 404📊 Changes
2 files changed (+19 additions, -8 deletions)
View changed files
📝
internal/web/controller/api.go(+5 -1)📝
internal/web/controller/api_auth_test.go(+14 -7)📄 Description
Summary
Authorization: Beareris present but the token does not match (or is disabled),checkAPIAuthnow returns 401 Unauthorized instead of masking as 404.Authorizationheader still get 404 (scanner masking preserved).webBasePathcontinues to 404 viaNoRoute, so script authors can distinguish auth failure from a mistyped base path.Fixes #6255
Test plan
go test ./internal/web/controller/ -run TestCheckAPIAuth_🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.