Skip to content

Honor sshproxy enforcement in container-based backends - #4244

Merged
un-def merged 1 commit into
masterfrom
pr_container_based_backends_authorized_keys
Sep 2, 2026
Merged

Honor sshproxy enforcement in container-based backends#4244
un-def merged 1 commit into
masterfrom
pr_container_based_backends_authorized_keys

Conversation

@un-def

@un-def un-def commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

VM-based backends receive the container's authorized keys uniformly, via dstack-shim task submission, which already omits the user key when DSTACK_SERVER_SSHPROXY_ENFORCED confines users to the SSH proxy. Container-based backends built the list ad-hoc inside run_job() and run_jobs() from run_spec.ssh_key_pub, so the user key reached the container regardless of the setting.

Add an extra_authorized_keys argument to Compute.run_job() and run_jobs(). The caller builds it once with get_extra_authorized_keys(), which applies the setting; Kubernetes, Runpod, Slurm and Vast.ai combine it with the project key through the new build_authorized_keys(), which requires the project key to be valid and skips extra keys that cannot be parsed. The argument is deliberately unvalidated at the call site, as most backends are shim-based and ignore it. The shim path now derives its key list from the same helper so that the two cannot drift.

VM-based backends receive the container's authorized keys uniformly, via
dstack-shim task submission, which already omits the user key when
DSTACK_SERVER_SSHPROXY_ENFORCED confines users to the SSH proxy.
Container-based backends built the list ad-hoc inside run_job() and
run_jobs() from run_spec.ssh_key_pub, so the user key reached the
container regardless of the setting.

Add an extra_authorized_keys argument to Compute.run_job() and
run_jobs(). The caller builds it once with get_extra_authorized_keys(),
which applies the setting; Kubernetes, Runpod, Slurm and Vast.ai combine
it with the project key through the new build_authorized_keys(), which
requires the project key to be valid and skips extra keys that cannot be
parsed. The argument is deliberately unvalidated at the call site, as
most backends are shim-based and ignore it. The shim path now derives
its key list from the same helper so that the two cannot drift.
@un-def
un-def merged commit 8d55d88 into master Sep 2, 2026
27 checks passed
@un-def
un-def deleted the pr_container_based_backends_authorized_keys branch September 2, 2026 10:53
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