xvkong233 40240ed02b fix(nat): strip only dashboard-issued Authorization credentials at NAT ingress
Since 2640b86 (v2.2.11, 2026-07-20) the NAT ingress deleted the entire
Authorization header, breaking self-hosted apps behind the tunnel that
authenticate with their own Bearer tokens (e.g. the Qinglong panel login
loop).

Strip only credentials issued by this dashboard and forward foreign ones:

- controller.IsDashboardCredential classifies an Authorization value as
  dashboard-issued via a signature-only JWT parser derived from the auth
  middleware (same key, HS256 pinned, claims validation deliberately
  skipped so an expired panel token is still recognized and kept out of
  the tunnel) or an api_tokens lookup for PAT-shaped values. Unknown PATs,
  foreign signatures, other schemes and missing values pass through. When
  classification cannot complete (parser not ready, DB nil or error) the
  verdict fails closed (strip) and the log carries a fixed reason only,
  never credential content.
- Both NAT capability variants (default, and agent-compat legacy /
  invalid-capability / post-consume paths) replace the unconditional
  Del("Authorization") with stripDashboardCredential. The rpc package
  receives the classifier through SetNATDashboardCredentialGate, the same
  injection pattern as SetMCPKillSwitchObserver; an unwired gate keeps the
  historical strip-everything behavior.

Tests: controller classification semantics (panel JWT, expired panel JWT
and panel PAT stripped; foreign-signed JWT, unknown nzp_ token, random
strings, non-Bearer schemes and missing header pass through; parser
unavailable, DB nil and DB error fail closed with credential-free logs)
plus rpc unit and flow coverage for both variants (dashboard credentials
never reach the forwarded bytes; foreign and missing Authorization are
forwarded untouched).

Compatibility: no API, database or frontend changes; NAT backends that do
not use Authorization behave exactly as before.
2026-10-01 11:17:45 +00:00
2025-02-28 22:19:57 +08:00
2026-09-14 11:06:44 +08:00
2025-03-22 22:44:25 +08:00
2021-01-30 11:22:59 +08:00
2026-02-15 13:13:33 +08:00
2026-09-02 13:30:46 +00:00
2026-09-02 13:30:46 +00:00
2021-03-22 17:41:38 +08:00
2026-09-14 11:23:19 +08:00



LOGO designed by 熊大 .

GitHub release (with filter)   Translation status

nezhahq%2Fnezha | Trendshift

:trollface: Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.

Supports monitoring system status, HTTP (SSL certificate change, upcoming expiration, expired), TCP, Ping and supports push alerts, run scheduled tasks and web terminal.

>> Telegram Channel: 哪吒监控(中文通知频道)
>> Telegram Group: Nezha Monitoring Global (English Only), 哪吒监控(中文群组)

>> Use Cases | 我们的用户 (Google)

Sponsors / 赞助商

VMRack
VMRack 洛杉矶 VPS|CN2 GIA + AS9929 + CMIN2 三网精品线路,AMD + NVMe 高性能!

👉 vmrack
99CDN
🚀 99CDN|自建 CDN,不止是加速!
边缘缓存 + 智能调度 + 自动故障切换 + 商业化运营

🌐 99cdn
AxisNow
AxisNow|自建私有部署 CDN|订阅式高防 CDN
自主可控、灵活组合的 CDN 网络

🌐 AxisNow
🤝

期待您的支持

User Guide

Contributing

Translation

Translation status

Is Nezha not in your language, or the translation is incorrect or incomplete? Get involved in the translations on Hosted Weblate.

Screenshots

用户前台 @hamster1963 管理后台 @nezhahq
user admin
hamster1963/nezha-dash nezhahq/admin-frontend

add your theme to service/singleton/frontend-templates.yaml

Contributors

naiba

UUBulb Akkia 卖女孩的小火柴 nap0o 黑歌 xykt Weblate (bot) MikoyChinese JackieSung4ev 77-QiQi Kris Lemoe spiritlhl 刘颜溪 CosmosZ-code Ko no dio Kris Mmx233 rootmelo92118 Moraxyc Xu 仓鼠 1ridic zhucaidan Sean lyj fscarmen windingFlame JSker9 Hsukqi Lee Darc Z. Creling Core F NikoCat233 adminsama Acgpiano eya46 guoyongchang 霧島拓真 honeok IYUANWEIZE igophper lvyaoting quanljh unclezs 缘生 严浩 凌 榆木 93 Coming Wel :D Esdese GreenTeodoro839 Ian Li KorenKrita Leon Martijn Lindeman Mingzhuo Yin Nanjing Hopefun Network Technology Co. Ltd. Spetrum Tao Chen Tater Li TomyJan Tony ace-consultoria Chra Mubelotix Ryrenz zhdsmy

Special Thanks

  • IPInfo for providing an accurate GeoIP Database.

Star History

Star History Chart

S
Description
No description provided
Readme Apache-2.0
57 MiB
0 Stars 1 Watchers 0 Forks
Languages
Go 99.3%
Shell 0.5%
PowerShell 0.2%