Skip to content

Support multiple init scripts and measure their hashes - #975

Merged
kvinwang merged 1 commit into
masterfrom
feat/init-script-array
Aug 3, 2026
Merged

Support multiple init scripts and measure their hashes#975
kvinwang merged 1 commit into
masterfrom
feat/init-script-array

Conversation

@kvinwang

@kvinwang kvinwang commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Infrastructure and cloud providers need to contribute initialization code that can be approved by multiple parties. Measuring each script separately lets every party verify its own approved code directly from attestation evidence without reconstructing and parsing the complete compose document. The per-script hashes are additional transparency measurements; compose-hash remains the authoritative measurement of the complete application configuration.

The five-script limit bounds runtime-event-log and MrConfigV3 growth while allowing several independently approved infrastructure initialization stages.

Summary

  • accept init_script as a string, an array of strings, or null, with a maximum of five scripts
  • require manifest v3 for multiple scripts and reject unsupported images in the UI before deployment
  • execute array entries in order while preserving multiline script boundaries
  • preserve compatibility by serializing exactly one script as a string and multiple scripts as an array
  • emit one ordered init-script-hash runtime event per script immediately after compose-hash
  • model MrConfigV3 init_script_hashes as optional: omission disables the check, while an explicit empty list requires no init scripts
  • when present, compare the MrConfigV3 list with hashes recomputed inside the guest
  • bind the list through SEV-SNP HOST_DATA and expose it through verified AppInfo
  • expose ordered hashes as optional values through AppInfo.init_script_hashes and decode_init_script_hashes(), preserving missing versus explicit empty lists
  • stop runtime-event hash collection at system-ready, excluding application-controlled events appended after boot
  • share one validated hash-list serde implementation from dstack-types
  • show scripts in separate VMM UI text areas with add/remove controls and enforce the five-script UI limit
  • fix gateway_enabled flatten serialization so AppCompose serialization is directly tested
  • update TDX, SNP, AWS, tutorial, and security-boundary documentation

Testing

  • cargo test -p dstack-types
  • cargo test -p dstack-util config_id_verifier
  • cargo test -p dstack-util test_multiple_init_scripts_require_v3_manifest
  • cargo test -p dstack-attest
  • cargo test -p dstack-vmm mr_config
  • cargo check -p dstack-vmm -p dstack-util -p dstack-attest -p dstack-verifier
  • npm run build in dstack/vmm/ui
  • bash -n os/common/rootfs/dstack-prepare.sh
  • git diff --check

Copilot AI review requested due to automatic review settings July 31, 2026 04:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kvinwang
kvinwang force-pushed the feat/init-script-array branch 11 times, most recently from 999e46a to 053269d Compare August 3, 2026 10:47
@kvinwang
kvinwang force-pushed the feat/init-script-array branch from 053269d to c4ea811 Compare August 3, 2026 10:54
@kvinwang
kvinwang merged commit eb908cb into master Aug 3, 2026
18 checks passed
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.

2 participants