Commit Graph

21068 Commits

Author SHA1 Message Date
Zexi Li
d5f3c8752f fix(llm): keep aiproxy routing across stop/restart (#25672)
Do not unsync or delete deployment ai_routing when replicas leave running; reconcile on running so routing/provider IDs stay stable.
v4.0.4-20260911.2
2026-09-11 16:43:10 +08:00
Zexi Li
45fc5cf0d0 feat(llm): route MCP agent via aiproxy virtual key and routing id (#25665)
Support X-Ai-Routing-Id to pin ai_routing, treat empty model_pattern as non-wildcard, and wire MCP agent to aiproxy credentials instead of direct LLM api_key.
v4.0.4-20260911.1
2026-09-11 10:13:45 +08:00
Jian Qiu
64801c02c1 fix: classic nic dhcp default gateway revisit (#25666)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
v4.0.4-20260911.0
2026-09-10 21:06:24 +08:00
Jian Qiu
8fdbce23d6 fix: keystone-role-assignments-list-scope (#25658)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-10 17:25:11 +08:00
Jian Qiu
82e3a751b2 fix(cloudid): omit clouduser secret from list and get responses (#25661)
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:22 +08:00
Jian Qiu
fd4f251d7a fix: keystone idp join project roles check (#25655)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-10 17:06:30 +08:00
Jian Qiu
d6dcae5da9 fix(llm): validate mcp agent server url and session endpoint (#25650)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 15:29:41 +08:00
Jian Qiu
f18dd74131 fix(llm): authenticate llm router agent route requests (#25648)
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:44:38 +08:00
Jian Qiu
730fa194a5 fix(llm): require get permission when resolving llm_id (#25646)
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 14:15:18 +08:00
Jian Qiu
4af0712a1b fix(identity): validate rolepolicy create and bind-role requests (#25643)
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:04 +08:00
屈轩
0b04770576 fix(region): convert kvm prefer storage (#25640) 2026-09-10 12:21:58 +08:00
Jian Qiu
94cff9d81e fix(identity): check assume login with system scope and target roles (#25636)
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:23 +08:00
Jian Qiu
c47b7b3e06 fix(image): reject images that declare a backing file (#25634)
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:54:50 +08:00
Jian Qiu
83fd5378f5 fix: allow host networks no gateway (#25624)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
v4.0.4-20260910.0
2026-09-10 01:32:59 +08:00
Jian Qiu
6c441f09d9 fix: classic net distribute default route for default nic (#25616)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-09 22:28:38 +08:00
Zexi Li
8560cd8450 fix(region): include disabled hosts in isolated device usage stats (#25620)
Keep GPU/device usages consistent with hosts inventory; scheduling still uses enabled hosts only.
2026-09-09 22:27:46 +08:00
Jian Qiu
4aa916cc23 fix(container): validate host bind paths and create host-path files with argv (#25604)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 20:29:23 +08:00
wanyaoqi
c3da18df12 fix(region): set force stop default timeout 30s (#25613) 2026-09-09 20:28:14 +08:00
Zexi Li
884de1bc51 fix(llm): skip stale container status during pod transitions (#25610)
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:51:57 +08:00
Zexi Li
cb876f036a fix(host): use assigned nvidia GPU memory for pod metrics (#25607)
Derive mem total from isolated-device quotas when available, and harden
losetup ListDevices against empty --json output.
2026-09-09 12:01:31 +08:00
Jian Qiu
4979e0f7b9 fix(guestfs): keep guest file deploy inside the mounted filesystem (#25601)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:47:10 +08:00
Jian Qiu
41d79c09d6 fix(identity): check SAML assertion issuer, audience, and optional signature (#25598)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:04:47 +08:00
屈轩
3597116f15 fix(region): support renew kvm vm (#25595) 2026-09-08 15:52:17 +08:00
Jian Qiu
c1e73206c8 fix(cloudcommon): fall back list query scope to the resource default view (#25589)
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>
v4.0.4-20260908.0
2026-09-08 14:52:35 +08:00
wanyaoqi
a65fb1b852 fix(host): start new goroutine to stop guest (#25585) 2026-09-08 14:09:14 +08:00
Zexi Li
038e530ebc feat(llm): support force restart for LLM and deployments (#25582)
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:13:46 +08:00
屈轩
27d6c94d7d fix(mcp-server): upgrade mcp lib (#25579) 2026-09-07 14:34:31 +08:00
Zexi Li
4ea6581102 feat(llm): allow disabling pod/container cgroup CPU and memory limits (#25576)
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 13:04:13 +08:00
Jian Qiu
3e77511214 fix(apigateway): authenticate csrf resource requests with the caller session (#25568)
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-07 12:13:32 +08:00
屈轩
4bf0b18ad0 fix(region): vendor update (#25572) 2026-09-07 10:28:48 +08:00
Jian Qiu
1dc0e3b5ec fix: module not found return 404 (#25560)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
v4.0.4-20260904.0 v4.0.4-20260905.0
2026-09-04 19:55:06 +08:00
Jian Qiu
df217c1be2 fix: verify test revisit (#25564)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-04 19:40:01 +08:00
屈轩
adf05b2988 fix(region): esxi v2v prefer storage (#25556) 2026-09-04 17:33:39 +08:00
Jian Qiu
3c35e76604 fix(webconsole): authenticate sftp endpoints and check session owner (#25551)
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:45:50 +08:00
Jian Qiu
790d1437a8 fix(webconsole): validate ssh target ip against accessible resources (#25548)
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:42 +08:00
Jian Qiu
5d5c052a9b fix(s3gateway): enforce signature freshness and single key decoding (#25536)
- 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:21 +08:00
Jian Qiu
3047bbdcda fix(webconsole): fetch kubeconfig with user session for k8s shell (#25539)
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:17 +08:00
Jian Qiu
2321b65ee1 fix(webconsole): generate session key with crypto/rand (#25542)
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:22 +08:00
Jian Qiu
70391d0158 fix(webconsole): isolate RDP console sessions with unique ids (#25545)
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:43 +08:00
wanyaoqi
af794715fd fix(region): use host type hypervisor rather than kvm (#25533) 2026-09-03 23:54:21 +08:00
Jian Qiu
4f1706d285 fix(appsrv): do not honor CORS credentials for wildcard origins (#25517)
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:52:58 +08:00
Jian Qiu
d8facf9ffd fix: convert sql.ErrNoRows to 404 not found (#25524)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-09-03 23:50:55 +08:00
Jian Qiu
8cab0232c4 fix(notify): harden verification code generation and verification (#25528)
- 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:48:40 +08:00
Jian Qiu
c053206af9 fix(hostimage): harden nbd export against command injection (#25531)
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:47:31 +08:00
Zexi Li
a79c399c2f feat(llm): support cancel and resume for instant model import (#25520)
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:35 +08:00
Jian Qiu
add8d8381f fix: mask tokens and passwords in logs (#25514)
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:27:34 +08:00
Jian Qiu
2b0d3d4362 fix(mcp-server): do not expose server-monitor as an MCP tool (#25512)
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:21:31 +08:00
屈轩
413f014f9c fix(region): vmware vm nic sync (#25509) 2026-09-03 18:27:32 +08:00
Jian Qiu
32477e1620 fix(hostman): harden deployer command execution against shell injection (#25499)
- 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 10:55:43 +08:00
Jian Qiu
4c3c641c97 fix(webconsole): harden climc shell command execution against injection (#25497)
- 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:52:10 +08:00