Commit Graph
273 Commits
Author SHA1 Message Date
Bot 00f5777112 Merge branch 'upstream/master' into master and preserve domain extensions 2026-08-31 02:46:42 +08:00
77-QiQi 28d731265c improve: skip empty addresses during DDNS updates (#1231) 2026-08-17 11:54:39 +08:00
Weblate (bot)andace-consultoria 42d9e4c8c3 Translated using Weblate (Portuguese (Brazil)) (#1228)
Currently translated at 95.0% (57 of 60 strings)


Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/pt_BR/
Translation: Nezha/Nezha Dashboard

Co-authored-by: ace-consultoria <erec.novais@aceconsultoria.org>
2026-08-15 09:34:18 +08:00
naiba d1fcde8e9e fix(security): block IPv6 transition ranges for webhooks 2026-08-11 14:23:14 +00:00
ace-consultoria 45af3d80a3 Added translation using Weblate (Portuguese (Brazil)) 2026-08-08 08:53:18 +00:00
Hosted WeblateandA b2c09443b3 Added translation using Weblate (Romanian)
Co-authored-by: A <cdparanoia@users.noreply.hosted.weblate.org>
2026-08-08 08:53:18 +00:00
naibaandnaiba/CloudCode c756ef9385 fix(rpc): make IO stream lifecycle race-safe
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
2026-07-20 04:26:19 +00:00
naibaandnaiba/CloudCode 8b47ff141f feat(agentcompat): add shared runtime contracts
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
2026-07-20 04:25:03 +00:00
naibaandcloudcode e8dabf5bc6 feat(auth): add PAT auth, scoped REST/MCP access, CSRF, and tenant isolation
Introduce Personal Access Tokens (nzp_*) as a stateless auth path alongside
JWT, gated per-endpoint by a scope middleware (nezha:{resource}:{verb}) with
fail-closed empty-scope defaults and a server-id whitelist. Self-management
endpoints (profile, api-tokens, oauth2 bind, refresh-token) explicitly reject
PATs to block privilege-escalation chains. A revoke registry tears down active
long-lived connections (terminal, fm, ws, transfer, mcp) the moment a PAT is
deleted, with a tombstone closing the revoke->register race.

Add an MCP endpoint that proxies tool calls (exec, fs read/write/delete,
transfer) to agents over gRPC, guarded by origin/DNS-rebinding checks, a
per-token rate limiter, audit logging, and a kill switch. Serialize all
sends through the IOStream wrapper to honour grpc-go's concurrency contract.

Add CSRF double-submit protection on unsafe cookie-authenticated methods,
exempting authenticated PAT requests by context identity (not a forgeable
Authorization header). Apply visibility/whitelist filtering consistently
across list, get-by-id, and mutate paths to enforce tenant isolation.

Migrate legacy mcp:* scopes: rewrite read/exec to nezha:* equivalents and
drop dangerous write/delete/wildcard grants.

Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
2026-05-30 15:56:44 +00:00
naibaandcloudcode d6f381d078 feat(idcodec): add hashid obfuscation derived from jwt secret
New pkg/idcodec wraps sqids with an alphabet derived from the JWT
secret via HKDF-SHA256 (info="nezha/idcodec/alphabet/v1"). Rotating
NZ_JWTSECRETKEY automatically reshuffles the alphabet, which doubles
as a kill switch for outstanding hashids without touching the encoder
itself.

The base alphabet drops visually-confusable characters (0/O/o/I/l/1)
and MinLength=8 hides small integer ids. Decode round-trips through
Encode to reject inputs that decode by accident under the same
alphabet.

Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
2026-05-26 03:50:36 +00:00
naibaandnaiba/CloudCode ea7ad67f03 fix(ddns): apply SSRF defense to webhook provider
GHSA-6x26-5727-rrm9: a low-privilege member could point a DDNS webhook
at internal or loopback hosts and the dashboard would dial them with the
unrestricted utils.HttpClient.

Extract the notification SSRF defenses (CIDR blocklist, IP-pin DialContext,
SNI preservation, redirect rejection) into reusable helpers in pkg/utils
(NewRestrictedHTTPClient / ResolveAllowedHTTPURL / buildRestrictedHTTPClient)
and route the DDNS webhook through the same path. Replace the notification
inline implementation with a thin wrapper to keep behaviour identical.

Side improvements collected by the refactor:
- prepareRequest now resolves DNS once and returns the paired client, so
  the dialer's pinned IP and the validated URL stay in sync (no more
  double resolution between prepareRequest and SetRecords).
- response body is drained and closed.
- HttpClient / HttpClientSkipTlsVerify are explicitly tagged unsafe for
  attacker-controlled URLs.

Tests cover: hermetic SNI preservation, redirect rejection, dial pin to
the vetted IP, the full blocked-CIDR list at the webhook entry point,
and the verifyTLS↔skipVerifyTLS inversion in the notification wrapper.

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
2026-05-18 15:14:27 +00:00
Bot c606fd99f6 chore: optimize and fix github actions (cleanup, CI fixes, security scanner tuning) 2026-04-26 22:25:00 +08:00
Buriburizaemon 2ad62df7b3 Merge upstream/master and resolve conflicts 2026-04-16 11:58:30 +08:00
Weblate (bot)andnlimeres 407017b1f6 Added translation using Weblate (Galician) (#1168)
Co-authored-by: nlimeres <dynosaurioprogramador@gmail.com>
2026-02-19 14:35:24 +08:00
Weblate (bot)andnlimeres 04553ca17f Added translation using Weblate (Galician) (#1168)
Co-authored-by: nlimeres <dynosaurioprogramador@gmail.com>
2026-02-19 14:35:24 +08:00
naiba 3c080d67eb fix(tsdb): update test to match 30s downsample interval for 1d period 2026-02-16 02:23:53 +08:00
naiba f9e379bdcc fix(tsdb): update test to match 30s downsample interval for 1d period 2026-02-16 02:23:53 +08:00
naiba d5172047eb feat(tsdb): increase 1d downsample resolution from 5min to 30s 2026-02-16 02:18:57 +08:00
naiba 4c1584dd5c feat(tsdb): increase 1d downsample resolution from 5min to 30s 2026-02-16 02:18:57 +08:00
3d0c9b963c feat(v2.0.0): tsdb (#1162)
* feat: tsdb

* fix(ci): remove --parseGoList=false from swag init to fix dependency resolution

* fix(ci): fix swag init directory and temporary remove s390x support due to cgo issues

* fix(ci): fix swag init output directory to cmd/dashboard/docs

* fix(ci): set GOTOOLCHAIN=auto for gosec

* feat: add system storage maintenance for SQLite and TSDB

* shit

* feat: add s390x support and improve service monitoring

* ci: upgrade goreleaser-cross image to v1.25

* ci: add libzstd-dev:s390x for cross-compilation

* ci: build libzstd for s390x from source

* ci: add libzstd_linux_s390x.go for gozstd linking

* ci: use vendor mode for s390x gozstd build

* ci: clone zstd source for s390x build

* refactor(tsdb): rename MaxDiskUsageGB to MinFreeDiskSpaceGB and optimize queries

- Rename config to accurately reflect VictoriaMetrics behavior: minimum free disk space threshold
- Add QueryServiceHistoryByServerID for batch query optimization
- Fix hasStatus to avoid false status counting when only delay data exists
- Fix service aggregation boundary: use successCount*2 >= count
- Fix serviceID parsing with strconv.ParseUint error handling
- Add TagFiltersCacheSize for better query performance

* feat(api): add server metrics endpoint and simplify service history response

- Add /server/:id/metrics API for querying TSDB server metrics
- Simplify getServiceHistory by removing redundant data conversion
- Change AvgDelay type from float32 to float64
- Remove generated swagger docs (to be regenerated)
- Update TSDB query, writer and tests

* chore: 临时禁用不支持前端

* ci: cache zstd build for s390x to speed up CI

* fix(tsdb): fix race conditions, data correctness and optimize performance

- Fix TOCTOU race between IsClosed() and write/query by holding RLock
- Fix delay=0 excluded from stats by using hasDelay flag instead of value > 0
- Fix fmt.Sscanf -> strconv.ParseUint for server_id parsing with error logging
- Fix buffer unbounded growth by flushing inside lock when over maxSize
- Split makeMetricRow into makeServerMetricRow/makeServiceMetricRow
- Extract InitGlobalSettings() from Open() for VictoriaMetrics globals
- Remove redundant instance/GetInstance/SetInstance singleton
- Add error logging for silently skipped block decode errors
- Optimize WriteBatch* to build all rows in single write call
- Optimize downsample to use linear scan instead of map for sorted data
- Optimize query slice reuse across block iterations

* 服务添加DisplayIndex (#1166)

* 服务添加DisplayIndex

* 根据ai建议修改

---------

Co-authored-by: huYang <306061454@qq.com>

* fix(tsdb): restore SQLite fallback and monthly status reload on restart

- Restore ServiceHistory model and SQLite write fallback when TSDB is disabled
- Reload monthlyStatus (30-day) and serviceStatusToday from TSDB/SQLite on startup
- Add SQLite fallback query for /service/:id/history and /server/:id/service
- Remove breaking GET /service/:id endpoint, keep /service/:id/history only
- Add QueryServiceDailyStats to TSDB for per-day aggregation
- Add tests for monthly status and today stats loading from both TSDB and SQLite
- Migrate ServiceHistory table only when TSDB is disabled

* ci: exclude false-positive gosec rules G117, G703, G704

* feat(api): expose tsdb_enabled in setting response

* ci: restore G115 exclusion accidentally dropped in previous commit

* fix: update version numbers for OfficialAdmin and Official templates

* chore: upgrade frontend

* chore: upgrade frontend

---------

Co-authored-by: 胡说丷刂 <34758853+laosan-xx@users.noreply.github.com>
Co-authored-by: huYang <306061454@qq.com>
2026-02-15 13:13:33 +08:00
e61772e858 feat(v2.0.0): tsdb (#1162)
* feat: tsdb

* fix(ci): remove --parseGoList=false from swag init to fix dependency resolution

* fix(ci): fix swag init directory and temporary remove s390x support due to cgo issues

* fix(ci): fix swag init output directory to cmd/dashboard/docs

* fix(ci): set GOTOOLCHAIN=auto for gosec

* feat: add system storage maintenance for SQLite and TSDB

* shit

* feat: add s390x support and improve service monitoring

* ci: upgrade goreleaser-cross image to v1.25

* ci: add libzstd-dev:s390x for cross-compilation

* ci: build libzstd for s390x from source

* ci: add libzstd_linux_s390x.go for gozstd linking

* ci: use vendor mode for s390x gozstd build

* ci: clone zstd source for s390x build

* refactor(tsdb): rename MaxDiskUsageGB to MinFreeDiskSpaceGB and optimize queries

- Rename config to accurately reflect VictoriaMetrics behavior: minimum free disk space threshold
- Add QueryServiceHistoryByServerID for batch query optimization
- Fix hasStatus to avoid false status counting when only delay data exists
- Fix service aggregation boundary: use successCount*2 >= count
- Fix serviceID parsing with strconv.ParseUint error handling
- Add TagFiltersCacheSize for better query performance

* feat(api): add server metrics endpoint and simplify service history response

- Add /server/:id/metrics API for querying TSDB server metrics
- Simplify getServiceHistory by removing redundant data conversion
- Change AvgDelay type from float32 to float64
- Remove generated swagger docs (to be regenerated)
- Update TSDB query, writer and tests

* chore: 临时禁用不支持前端

* ci: cache zstd build for s390x to speed up CI

* fix(tsdb): fix race conditions, data correctness and optimize performance

- Fix TOCTOU race between IsClosed() and write/query by holding RLock
- Fix delay=0 excluded from stats by using hasDelay flag instead of value > 0
- Fix fmt.Sscanf -> strconv.ParseUint for server_id parsing with error logging
- Fix buffer unbounded growth by flushing inside lock when over maxSize
- Split makeMetricRow into makeServerMetricRow/makeServiceMetricRow
- Extract InitGlobalSettings() from Open() for VictoriaMetrics globals
- Remove redundant instance/GetInstance/SetInstance singleton
- Add error logging for silently skipped block decode errors
- Optimize WriteBatch* to build all rows in single write call
- Optimize downsample to use linear scan instead of map for sorted data
- Optimize query slice reuse across block iterations

* 服务添加DisplayIndex (#1166)

* 服务添加DisplayIndex

* 根据ai建议修改

---------

Co-authored-by: huYang <306061454@qq.com>

* fix(tsdb): restore SQLite fallback and monthly status reload on restart

- Restore ServiceHistory model and SQLite write fallback when TSDB is disabled
- Reload monthlyStatus (30-day) and serviceStatusToday from TSDB/SQLite on startup
- Add SQLite fallback query for /service/:id/history and /server/:id/service
- Remove breaking GET /service/:id endpoint, keep /service/:id/history only
- Add QueryServiceDailyStats to TSDB for per-day aggregation
- Add tests for monthly status and today stats loading from both TSDB and SQLite
- Migrate ServiceHistory table only when TSDB is disabled

* ci: exclude false-positive gosec rules G117, G703, G704

* feat(api): expose tsdb_enabled in setting response

* ci: restore G115 exclusion accidentally dropped in previous commit

* fix: update version numbers for OfficialAdmin and Official templates

* chore: upgrade frontend

* chore: upgrade frontend

---------

Co-authored-by: 胡说丷刂 <34758853+laosan-xx@users.noreply.github.com>
Co-authored-by: huYang <306061454@qq.com>
2026-02-15 13:13:33 +08:00
UUBulb c22446b20c feat(notification): add option to convert metric units in request body (#1156)
* feat(notification): add option to convert metric units in request body

* ignore gosec

* rename fields
2026-01-10 17:29:10 +08:00
UUBulb 302d278644 feat(notification): add option to convert metric units in request body (#1156)
* feat(notification): add option to convert metric units in request body

* ignore gosec

* rename fields
2026-01-10 17:29:10 +08:00
e4d42a617f Added translation using Weblate (Ukrainian) (#1128)
Added translation using Weblate (Japanese)

Co-authored-by: Zilong Liu <2821624044@qq.com>
Co-authored-by: Руслан Пузич <visp80@gmail.com>
2026-01-01 10:33:59 +08:00
6b07370c1b Added translation using Weblate (Ukrainian) (#1128)
Added translation using Weblate (Japanese)

Co-authored-by: Zilong Liu <2821624044@qq.com>
Co-authored-by: Руслан Пузич <visp80@gmail.com>
2026-01-01 10:33:59 +08:00
Buriburizaemon 0eb104a2d6 <fixed>fixed bugs that ipinfo db using different symbol for country iso. 2025-12-28 17:40:15 +00:00
Buriburizaemon 3fcfe1eaf1 <edit>added new geoip data, and readme file. 2025-12-29 00:49:42 +08:00
naiba 3b2cefdd07 feat: binding ip with session
🛡️staying safe even your frontend was hacked
2025-10-09 21:36:59 +08:00
naiba 540c1cb1e7 feat: binding ip with session
🛡️staying safe even your frontend was hacked
2025-10-09 21:36:59 +08:00
Buriburizaemon 1c11637e43 <edit>fixed geoip bugs. 2025-09-13 13:04:16 +08:00
Buriburizaemon 209e78dac6 <edit>add a usable geoip. 2025-09-13 12:44:53 +08:00
e4144f2d6c Added translation using Weblate (French) (#1093)
Translated using Weblate (Indonesian)

Currently translated at 45.0% (27 of 60 strings)

Translated using Weblate (Tamil)

Currently translated at 100.0% (60 of 60 strings)





Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/id/
Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/ta/
Translation: Nezha/Nezha Dashboard

Co-authored-by: Kxroqi :3 <loxocker@gmail.com>
Co-authored-by: TommyLPB <hcrochetcanard@gmail.com>
Co-authored-by: தமிழ்நேரம் <anishprabu.t@gmail.com>
2025-08-02 15:52:14 +08:00
799f4a9d61 Added translation using Weblate (French) (#1093)
Translated using Weblate (Indonesian)

Currently translated at 45.0% (27 of 60 strings)

Translated using Weblate (Tamil)

Currently translated at 100.0% (60 of 60 strings)





Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/id/
Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/ta/
Translation: Nezha/Nezha Dashboard

Co-authored-by: Kxroqi :3 <loxocker@gmail.com>
Co-authored-by: TommyLPB <hcrochetcanard@gmail.com>
Co-authored-by: தமிழ்நேரம் <anishprabu.t@gmail.com>
2025-08-02 15:52:14 +08:00
d0cf04a3d3 Translated using Weblate (Indonesian) (#1049)
Currently translated at 43.3% (26 of 60 strings)

Added translation using Weblate (Indonesian)

Translated using Weblate (Vietnamese)

Currently translated at 16.6% (10 of 60 strings)

Added translation using Weblate (Vietnamese)

Translated using Weblate (Spanish)

Currently translated at 100.0% (60 of 60 strings)





Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/es/
Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/id/
Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/vi/
Translation: Nezha/Nezha Dashboard

Co-authored-by: Andres Pava <hola@andrespava.com>
Co-authored-by: Kxroqi :3 <loxocker@gmail.com>
Co-authored-by: hzhoanglee <nganhh.bi12-313@st.usth.edu.vn>
2025-06-08 00:49:31 +08:00
0005f923a5 Translated using Weblate (Indonesian) (#1049)
Currently translated at 43.3% (26 of 60 strings)

Added translation using Weblate (Indonesian)

Translated using Weblate (Vietnamese)

Currently translated at 16.6% (10 of 60 strings)

Added translation using Weblate (Vietnamese)

Translated using Weblate (Spanish)

Currently translated at 100.0% (60 of 60 strings)





Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/es/
Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/id/
Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/vi/
Translation: Nezha/Nezha Dashboard

Co-authored-by: Andres Pava <hola@andrespava.com>
Co-authored-by: Kxroqi :3 <loxocker@gmail.com>
Co-authored-by: hzhoanglee <nganhh.bi12-313@st.usth.edu.vn>
2025-06-08 00:49:31 +08:00
UUBulb 04d7651f58 update dependencies (#1077)
* update dependencies

ddns: update libdns to 1.0.0

* rename var
2025-05-02 00:25:23 +08:00
UUBulb bcc4104bde update dependencies (#1077)
* update dependencies

ddns: update libdns to 1.0.0

* rename var
2025-05-02 00:25:23 +08:00
UUBulb 5c27259439 chore: cleanup some code (#1069)
* chore

* modernize loop

* ddns: simpify Provider struct
2025-04-26 18:28:21 +08:00
UUBulb 4871211f93 chore: cleanup some code (#1069)
* chore

* modernize loop

* ddns: simpify Provider struct
2025-04-26 18:28:21 +08:00
UUBulb 56769c9451 i18n: replace gettext implementation (#1056) 2025-04-13 12:26:03 +08:00
UUBulb 91cb5e903f i18n: replace gettext implementation (#1056) 2025-04-13 12:26:03 +08:00
UUBulb b3377127a4 update ddns on server update (#1050) 2025-03-31 19:41:04 +08:00
UUBulb 67c129635e update ddns on server update (#1050) 2025-03-31 19:41:04 +08:00
naiba c5a9abda38 chore: remove unused code 2025-03-29 13:18:12 +08:00
naiba c4148fe915 chore: remove unused code 2025-03-29 13:18:12 +08:00
Weblate (bot)andAndres Pava 604b03d235 Translated using Weblate (Spanish) (#1048)
Currently translated at 100.0% (60 of 60 strings)


Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/es/
Translation: Nezha/Nezha Dashboard

Co-authored-by: Andres Pava <hola@andrespava.com>
2025-03-29 11:28:06 +08:00
Weblate (bot)andAndres Pava 3bcba0c2de Translated using Weblate (Spanish) (#1048)
Currently translated at 100.0% (60 of 60 strings)


Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/es/
Translation: Nezha/Nezha Dashboard

Co-authored-by: Andres Pava <hola@andrespava.com>
2025-03-29 11:28:06 +08:00
naiba ca35040d0b feat: upgrade frontend 2025-03-22 22:44:25 +08:00
naiba 954939e99d feat: upgrade frontend 2025-03-22 22:44:25 +08:00
61d4240638 Translated using Weblate (Russian) (#1040)
Currently translated at 100.0% (60 of 60 strings)

Translated using Weblate (Russian)

Currently translated at 100.0% (60 of 60 strings)

Added translation using Weblate (Russian)




Translate-URL: https://hosted.weblate.org/projects/nezha/nezha-dashboard/ru/
Translation: Nezha/Nezha Dashboard

Co-authored-by: UUBulb <uub@kuzu.uk>
Co-authored-by: bios let <bioslet@gmail.com>
2025-03-22 22:32:12 +08:00