Commit Graph
19 Commits
Author SHA1 Message Date
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
Moraxyc 67190459f8 Refactor: Load UserTemplates from embedded yaml file (#575)
* Refactor: Load UserTemplates from embedded yaml file

* feat: add version field to UserTemplates

* refactor: use shell script to fetch frontends

* chore: add *-dist to .gitignore

* refactor: rename to FrontendTemplates

BREAKING CHANGE: This commit changes the `user_templates` filed
in the communication json between backend and the admin-frontend.

Keep user config.yml `user_template` filed.
2024-12-10 21:57:20 +08:00
naiba 9ba3a4fb2b feat: embed dist 2024-11-29 21:31:39 +08:00
uubulb 96bec45855 add zh_TW locale, rename ssl to tls 2024-11-01 14:32:55 +08:00
naiba c93ec14bc1 feat: dev docker 2024-10-24 21:33:36 +08:00
naiba 37c87bbc07 🎉 init swaggo 2024-10-19 23:14:53 +08:00
naiba 040270e3ab Export custom static folder 2023-11-29 17:13:45 +08:00
naiba 90469dfba7 clean: remove agent 💩 2023-05-11 00:13:11 +08:00
naiba 9633662708 🚀 dashboard v0.13.16 自定义外部主题 2022-05-19 09:46:11 +08:00
naiba 81f3d5c4ef 可选监控哪些分区及网卡 2022-03-19 17:22:15 +08:00
naiba 7e5a91160a ️ pprof 性能调优 / 计划任务支持秒级 2021-09-29 19:58:02 +08:00
naiba 9e2ac9b8ea v0.9.22 WebSSH 2021-08-18 17:42:26 +08:00
kkk 8e41603bfe 添加 idea 忽略文件,修改 css 2021-03-02 10:36:42 +08:00
naiba 8d2933ac21 一键脚本 2020-11-29 22:17:40 +08:00
naiba ba0c5b4223 🚚 add pb code 2020-10-24 21:46:07 +08:00
奶爸 654905236b systemd 文件 2019-12-11 13:34:22 +08:00
奶爸 f2f840de4a Web 服务 2019-12-08 16:59:58 +08:00
奶爸 20dc595fdd protobuf 代码生成 2019-12-05 23:42:20 +08:00
奶爸 392eb3aee3 Initial commit 2019-11-09 12:01:46 +08:00