Skip to content

fix(vmm): enforce port mapping policy on update_vm - #1286

Merged
kvinwang merged 1 commit into
nextfrom
fix/operator-boundary
Sep 24, 2026
Merged

kvinwang merged 1 commit into
nextfrom
fix/operator-boundary

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

create_manifest_from_vm_config enforces cvm.port_mapping (enabled and range), but update_vm builds its port map without consulting it. CreateVm with no ports followed by UpdateVm { update_ports: true, ports: [...] } publishes any host port, even on a node with port mapping disabled (GHSA-hqm3-qmh8-5xx2).

The update path also parses an empty host_address instead of falling back to cvm.port_mapping.address, so a request shape valid at deploy time fails on update with "Invalid host address".

Fix

Both paths go through a shared port_map_from_proto. Mappings the VM already holds are exempt from the policy check: the web UI sends update_ports = true with the full current list on every update, so without the exemption narrowing the node's policy would block every other update to an affected VM. Deployment passes no held mappings.

Compat: updates that add a mapping outside the node's policy are now rejected; an omitted host_address on update is now accepted.

GPU part split into #1346 (merged).

Verification

cargo test -p dstack-vmm (211 passed), cargo clippy -p dstack-vmm --bins -- -D warnings, cargo fmt --check.

@kvinwang
kvinwang force-pushed the fix/operator-boundary branch from 46cd04a to 4dca9f7 Compare September 24, 2026 04:52
@kvinwang kvinwang changed the title fix(vmm): an update publishes a port the node forbids, and a named GPU is any PCI address fix(vmm): enforce port mapping policy on update_vm Sep 24, 2026
@kvinwang
kvinwang force-pushed the fix/operator-boundary branch from 4dca9f7 to b904504 Compare September 24, 2026 05:41
@kvinwang
kvinwang added this pull request to stack #1352 September 24, 2026 06:17
@kvinwang
kvinwang merged commit b01a88f into next Sep 24, 2026
11 checks passed
@kvinwang
kvinwang deleted the fix/operator-boundary branch September 24, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant