Commit Graph

21089 Commits

Author SHA1 Message Date
Jian Qiu
1074f3694d fix: classic nic dhcp default gateway revisit (#25670)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-10 21:05:32 +08:00
Jian Qiu
0590e3a434 fix: keystone-role-assignments-list-scope (#25652)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-10 17:25:32 +08:00
Jian Qiu
3c47ebba45 fix(cloudid): omit clouduser secret from list and get responses (#25651)
Return console login details from the login-info action; skip secret in resource JSON and logs.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 17:24:44 +08:00
Jian Qiu
23d7222bd0 fix: keystone idp join project roles check (#25653)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-10 16:39:09 +08:00
Jian Qiu
e96ca5b665 fix(llm): validate mcp agent server url and session endpoint (#25622)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 15:29:59 +08:00
Jian Qiu
c16d7fcb58 fix(llm): authenticate llm router agent route requests (#25626)
Fetch the agent with the caller session and check perform permission.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 14:37:17 +08:00
Jian Qiu
4b9f523424 fix(llm): require get permission when resolving llm_id (#25627)
Fetch the referenced LLM with the caller session before filling access URL fields.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 13:19:53 +08:00
Jian Qiu
19d63a7a36 fix(identity): validate rolepolicy create and bind-role requests (#25628)
Require role_id and reuse the role add-policy checks when creating a binding.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 13:10:46 +08:00
屈轩
d87a26f70c fix(region): convert kvm prefer storage (#25631) 2026-09-10 12:21:45 +08:00
Jian Qiu
b1d1cad973 fix(identity): check assume login with system scope and target roles (#25629)
Keep the caller session when authorizing assume and reuse join-project role checks.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 12:14:33 +08:00
Jian Qiu
f208976ef0 fix(ansible): validate playbook inventory, connection, and file paths (#25605)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 11:55:48 +08:00
Jian Qiu
c24383dd63 fix(image): reject images that declare a backing file (#25630)
Treat a non-empty backing filename as unsupported on upload, convert, probe, and ceph cache.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 11:55:18 +08:00
Jian Qiu
cb3e3cbb08 fix: allow host networks no gateway (#25625)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-10 01:32:49 +08:00
Jian Qiu
b6b9a3a2ab fix: classic net distribute default route for default nic (#25618)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-09 22:29:00 +08:00
Zexi Li
66409634a4 fix(region): include disabled hosts in isolated device usage stats (#25621)
Keep GPU/device usages consistent with hosts inventory; scheduling still uses enabled hosts only.
2026-09-09 22:27:59 +08:00
Jian Qiu
9f38eaea55 fix(container): validate host bind paths and create host-path files with argv (#25591)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 20:28:55 +08:00
wanyaoqi
a31b6bd52b fix(region): set force stop default timeout 30s (#25614) 2026-09-09 20:28:36 +08:00
Zexi Li
ee255297a7 fix(llm): skip stale container status during pod transitions (#25611)
Watch container events and defer LLM status updates while the pod is starting/stopping, so exited leftovers are not treated as start_fail.
2026-09-09 16:52:11 +08:00
Zexi Li
6f6d0a70c9 fix(host): use assigned nvidia GPU memory for pod metrics (#25608)
Derive mem total from isolated-device quotas when available, and harden
losetup ListDevices against empty --json output.
2026-09-09 12:01:47 +08:00
Jian Qiu
24e1299648 fix(guestfs): keep guest file deploy inside the mounted filesystem (#25592)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:46:58 +08:00
Jian Qiu
0b7ecb6c3c fix(identity): check SAML assertion issuer, audience, and optional signature (#25596)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:04:56 +08:00
屈轩
705ae5ef5a fix(region): support renew kvm vm (#25593) 2026-09-08 15:50:11 +08:00
Jian Qiu
d6419376fa fix(cloudcommon): fall back list query scope to the resource default view (#25587)
When admin or scope query parameters do not map to a concrete view, use the resource's own scope and keep owner filters applied.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:34:20 +08:00
wanyaoqi
876a893dc1 fix(host): start new goroutine to stop guest (#25586) 2026-09-08 14:08:53 +08:00
Zexi Li
da6ea51b5c feat(llm): support force restart for LLM and deployments (#25583)
Allow force restart when instances are failed, protect restarting status
during sync, refresh GPU memory from deployment, and tolerate crash-loop
while waiting for service ready.
2026-09-07 21:14:00 +08:00
屈轩
5fb64e76d2 fix(mcp-server): upgrade mcp lib (#25574) 2026-09-07 14:25:53 +08:00
Zexi Li
80c4977f58 feat(llm): allow disabling pod/container cgroup CPU and memory limits (#25577)
Inference SKUs default to off; SKU and CLI expose enable flags so hosts can skip CFS quota and memory hard limits when needed.
2026-09-07 14:06:35 +08:00
屈轩
d76698cfa1 fix(region): vendor update (#25570) 2026-09-07 10:27:13 +08:00
Jian Qiu
56fec3fcb5 fix(apigateway): authenticate csrf resource requests with the caller session (#25566)
Align the csrf resource handler with other API resource handlers by requiring a token and forwarding with the caller's own session.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 20:48:18 +08:00
Jian Qiu
0f830b4219 fix: verify test revisit (#25562)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-04 19:39:30 +08:00
Jian Qiu
59b658ce87 fix: module not found return 404 (#25558)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-04 19:23:42 +08:00
屈轩
bb540b7a4a fix(region): esxi v2v prefer storage (#25554) 2026-09-04 17:33:31 +08:00
Jian Qiu
95332ed656 fix(webconsole): authenticate sftp endpoints and check session owner (#25502)
The sftp list/download/upload endpoints were not protected by
authentication, only by the UUID4 session id. Anyone who learned the
session id (it appears in URLs and logs) could list, download and
upload files of the VM over the victim's active SSH/SFTP channel.

Wrap all three endpoints with auth.Authenticate and record the owner
of each sftp session at registration, so only the user who opened the
session can use it.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 13:46:08 +08:00
Jian Qiu
2f0ce30f5c fix(webconsole): validate ssh target ip against accessible resources (#25487)
The ssh console endpoint accepted a raw ip address in the URL path
and dialed it directly with user provided credentials, so any
authenticated user could use the webconsole service as an internal
SSH proxy, port scanner and credential brute-forcer.

Resolve the ip against hosts (access_ip) and servers (ip_addr)
visible to the user's session and require it to match one of them,
rejecting all other addresses.

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 10:06:25 +08:00
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