Commit Graph

21055 Commits

Author SHA1 Message Date
Jian Qiu
f56e2327b1 fix(s3gateway): enforce signature freshness and single key decoding (#25490)
- Reject signed requests older or newer than 15 minutes (x-amz-date
  for v4, Date for v2), so intercepted valid requests can no longer
  be replayed indefinitely
- Decode the object key exactly once: r.URL.Path is already decoded
  by net/http and is the form the signature covers, decoding again
  let a signature for one key be replayed against another
  (e.g. %252e%252e%252f resolving to ../)
- Add unit tests for both behaviors

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 09:19:43 +08:00
Jian Qiu
c805952b40 fix(webconsole): fetch kubeconfig with user session for k8s shell (#25484)
The k8s shell/log endpoints fetched the target cluster kubeconfig
with the admin session, bypassing RBAC and owner scope checks, so any
authenticated user could exec into pods and read logs of any
registered cluster.

Fetch the kubeconfig with the user's own session instead, so policy
checks and owner filtering apply, and command records are attributed
to the real user.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 09:18:52 +08:00
Jian Qiu
bebb68775f fix(webconsole): generate session key with crypto/rand (#25486)
The AES key encrypting all console session tokens was derived from
rand.Float32 with only about 24 bits of entropy, so it could be
recovered by brute force from a single known (session id, token)
pair and then be used to forge access tokens of arbitrary sessions.

Generate the key from 32 crypto/rand bytes instead (about 192 bits
of effective entropy). Sessions live in process memory only, so a
per-process random key is sufficient.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 09:17:43 +08:00
Jian Qiu
afc0519d87 fix(webconsole): isolate RDP console sessions with unique ids (#25485)
RemoteRDPConsoleInfo.GetId() always returned an empty string, so all
RDP sessions were stored under the same key in the session manager:
any valid RDP access token resolved to whatever RDP session was stored
last, letting a user take over another user's console session
(host/port/username/password).

Give every RDP session a random UUID id and validate in
SSessionManager.Get that the presented access token is exactly the
one issued for the session, so sessions can not be reached by any
other token.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 09:16:50 +08:00
wanyaoqi
c29357296d fix(region): use host type hypervisor rather than kvm (#25534) 2026-09-03 23:54:52 +08:00
Jian Qiu
c557a8b230 fix(appsrv): do not honor CORS credentials for wildcard origins (#25501)
With cors_hosts unset (the default), the CORS middleware allowed all
origins and echoed the request origin together with
Access-Control-Allow-Credentials, so any website could make
authenticated cross-origin requests against the API with the user's
cookies.

Credentials are now only honored for explicitly listed origins:
with an empty or wildcard origin allowlist the middleware responds
with Access-Control-Allow-Origin: * and no credentials header.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 23:53:36 +08:00
Jian Qiu
ba61b4040b fix: convert sql.ErrNoRows to 404 not found (#25522)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-03 23:51:53 +08:00
Jian Qiu
9c88aa36d8 fix(notify): harden verification code generation and verification (#25483)
- Generate verification codes with crypto/rand instead of the
  predictable time-seeded math/rand
- Count failed verification attempts and invalidate the code after
  verify_max_attempts (default 5) failures, closing the unlimited
  online brute force of the 6-digit code at the login endpoint
- Delete the verification record after a successful check so codes
  are single use and can not be replayed within the validity window
- Add unit tests for code generation

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 23:49:29 +08:00
Jian Qiu
d4de3860df fix(hostimage): harden nbd export against command injection (#25491)
The nbd export endpoints interpolated the request disk_id into
shell commands (sh -c with the joined qemu-nbd command line, and
ps|grep for the process check), so a crafted disk_id could execute
arbitrary commands as root on the host image service.

- Require the disk_id to be a plain UUID in both export and close
  endpoints
- Run qemu-nbd with argv instead of sh -c
- Check the export process via its pid file and kill -0 instead of
  shell pipelines
- Add unit tests for the validation and the process check

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 23:48:20 +08:00
Zexi Li
c6bc5f5de2 feat(llm): support cancel and resume for instant model import (#25521)
Allow deleting models to abort in-flight downloads, persist import input for resume-import after killed status, and clean up import cache on delete.
2026-09-03 20:14:48 +08:00
Jian Qiu
d4fa442de0 fix(mcp-server): do not expose server-monitor as an MCP tool (#25488)
server-monitor sends arbitrary QMP/HMP commands (pmemsave, migrate,
etc.) to a running guest, which exceeds the semantics of monitoring.
As an MCP tool it could be triggered without human awareness through
LLM prompt injection or the tool-request endpoint.

Remove the mcp-desc registration tag from ServerMonitorOptions so
climcgen no longer registers the tool, drop its mention from the MCP
instructions, and add a regression test asserting it is not exposed.
The climc command and the permission-gated region API are unchanged.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 19:22:30 +08:00
Jian Qiu
2aace16f5f fix: mask tokens and passwords in logs (#25489)
Full session tokens were written to logs in policy.go, mcclient auth,
oidc handler and the webconsole session manager; guest root passwords
were logged by the linux fsdriver and the nbdkit mount command; MCP
tool arguments and full JSON-RPC bodies (which may contain
server-reset-password passwords) were logged by the llm agent.

Truncate tokens in log messages, drop or mask password values and
log only the tool/method name for MCP calls.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 19:20:25 +08:00
屈轩
b1a21ffefc fix(region): vmware vm nic sync (#25507) 2026-09-03 18:27:21 +08:00
Jian Qiu
1f7d15ae83 fix(hostman): harden deployer command execution against shell injection (#25477)
- Quote the heredoc delimiter when writing deploy params to the
  deployer guest, so deploy content, passwords and other
  user-supplied values are written literally and shell expansions
  ($(...), backticks, $VAR) inside them are not evaluated by the
  remote shell
- Escape JSON passed via --deploy-params as a single POSIX shell
  word, preventing single quotes in user data from breaking out of
  the argument
- Add unit tests covering injection payloads

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 17:59:23 +08:00
Jian Qiu
bb4e9a4e13 fix(webconsole): harden climc shell command execution against injection (#25476)
- Run ssh via exec.Command argv instead of "bash -c" string
  interpolation, so user-supplied fields can no longer escape into
  local shell commands on the webconsole server
- Quote every interpolated value (env, command, args) as a POSIX
  shell word, so they stay literal data on the remote shell
- Validate username charset and limit target_ip to climc pod or container
- Add unit tests covering injection payloads

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-03 10:51:51 +08:00
Jian Qiu
fb44b7fac2 fix: apigateway returns cors_hosts to browser (#25494)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-03 00:50:29 +08:00
Jian Qiu
f74aae22a4 fix: update rpm build scripts for openeuler (#25475)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-02 20:28:49 +08:00
Zexi Li
5bde2cafbe Automated cherry pick of #25479: Feat/aiproxy model context window (#25481)
* feat(aiproxy): expose catalog context window on AI models

Populate known 1M+ context windows in catalog seed data and return
context_window in AI model list/detail API responses.

* feat(aiproxy): add instance test-connectivity and set-models actions

Add provider instance test-connectivity using stored ai_key secrets,
and set-models to import selected catalog models while skipping
existing model_key rows. Register corresponding climc perform commands.
2026-09-02 17:43:58 +08:00
wanyaoqi
c6352a338d fix(region): disable startrun snapshotsCleanup (#25449) 2026-09-02 15:59:32 +08:00
Zexi Li
4641bf4ade fix(cloudcommon): fix err shadowing in GetPropertyDistinctField (#25472) 2026-09-02 15:58:21 +08:00
屈轩
25f1a39139 fix(region): optimized cachedimage list (#25465) 2026-09-02 11:40:09 +08:00
屈轩
117fb60199 fix(region): support filter cloudprovider by regions (#25460) 2026-09-01 16:05:47 +08:00
屈轩
9f2b500694 fix(region): vendor update (#25457) 2026-09-01 13:41:26 +08:00
屈轩
3082bb6b83 fix(apigateway): update mcp api addr (#25454) 2026-09-01 13:41:09 +08:00
屈轩
7de35e60e3 fix(region): optimized cachedimage list (#25450) 2026-09-01 09:18:08 +08:00
Zexi Li
1b2a11f3ef feat(llm): add llm_sku clone API and climc support (#25445) 2026-08-27 19:00:54 +08:00
wanyaoqi
9e790b049c fix(region,host): optimize snapshot delete (#25440)
use rebase/commit merge backing chain instead of convert.
2026-08-27 16:27:19 +08:00
wangyf0611
a722b3dd69 feat(region,host): support riscv64 usage (#25439)
* feat(region): include riscv64 usage statistics

Signed-off-by: wangyf0611 <wangyufeng@iscas.ac.cn>

* feat(host): support openRuyi guest initialization

Signed-off-by: wangyf0611 <wangyufeng@iscas.ac.cn>

---------

Signed-off-by: wangyf0611 <wangyufeng@iscas.ac.cn>
2026-08-27 16:22:11 +08:00
wanyaoqi
0485a84dc0 fix(region): batch detach isolated devices (#25433) 2026-08-27 13:49:16 +08:00
wanyaoqi
575b0ed7be fix(region): set default stop time 300s (#25432) 2026-08-26 15:22:11 +08:00
Jian Qiu
a2e80e5681 fix: allow empty host networks (#25429)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-08-26 14:40:55 +08:00
屈轩
526e1770ef fix(region): not real delete glance cachedimage (#25423) 2026-08-25 14:58:56 +08:00
wanyaoqi
b7420fc08c fix(host-deployer): no noeed clean failed mountpoints (#25422) 2026-08-25 11:37:07 +08:00
Jian Qiu
338fabca7e fix: allow create-disk without disk args (#25415)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-08-24 15:48:23 +08:00
Jian Qiu
a4e15c7f59 fix: allow create-disk without disk args (#25413)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-08-24 15:47:16 +08:00
屈轩
654789b5b0 fix(region): v2v migrate uefi check (#25416) 2026-08-24 15:40:45 +08:00
屈轩
923053aa4d fix(glance): avoid receive notify when glance restart (#25409) 2026-08-24 15:05:04 +08:00
wanyaoqi
bd3e8d0d97 fix(host): guest desc correct rbd disk path (#25396) 2026-08-24 14:37:09 +08:00
wanyaoqi
9b3b41a13b fix(host-health,region): host health detect network available add check peers and default gw (#25385) 2026-08-24 14:34:36 +08:00
屈轩
bb21271162 fix(region): skip hostlocal wire when detect vmware net (#25404) 2026-08-24 14:19:28 +08:00
屈轩
e47a923065 fix(region): show more error info for vmware net detect (#25400) 2026-08-24 10:21:28 +08:00
Zexi Li
2de295222d feat(llm): merge SKU envs into container and validate prefer_hosts updates (#25389)
Allow local_path SKUs to update prefer_hosts on edit, and overlay SKU envs onto the primary container with same-key override.
2026-08-21 14:27:58 +08:00
Jian Qiu
63ef1dad78 fix: unhandled errors (#25383)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-08-20 17:30:29 +08:00
Zexi Li
d2981f8111 fix(host): skip unmanage interface when bridge slave has no address (#25382)
Only call tryUnmanageInterface when the slave interface has IPv4 or IPv6
addresses configured, avoiding unnecessary NetworkManager unmanage on
address-less interfaces during bridge setup.
2026-08-20 17:26:54 +08:00
屈轩
de26e6140d fix(region): skip sync cloudpods kvm secgroup (#25376) 2026-08-20 10:45:00 +08:00
wanyaoqi
360fbbd47b Automated cherry pick of #25365: fix(region,host): guest stop add timeout options,and check is_force (#25371)
* fix(host): check qga guest-get-osinfo error

* fix(region,host): guest stop add timeout options and is_force check
2026-08-20 10:15:55 +08:00
屈轩
d2755e8370 fix(region): support cloudpods ipset (#25360) 2026-08-19 18:56:30 +08:00
Zexi Li
29f65063b7 fix(scheduler): report HAMI hostFree before min-memory filter (#25372)
Shortage messages now show remaining GPU memory from matched devices
before min-memory filtering, so users see actual free capacity instead of 0.
2026-08-19 16:40:51 +08:00
Jian Qiu
f2ffa5d034 fix: storage set metadata in post_create (#25367)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-08-19 16:21:25 +08:00
wanyaoqi
9393059615 Automated cherry pick of #25347: fix(host): add options enabel vendor/device pt usb dev (#25349)
* fix(host): add options enabel vendor/device pt usb dev

* fix(host): add audio device for spice driver
2026-08-19 14:13:16 +08:00