Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/security/cvm-boundaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ This file contains metadata about the application instance:
| Field | Description |
|-------|-------------|
| app_id | The application ID. This is the deploy-time `app_id` from this file; when it is unset it defaults to the SHA256 digest of the app-compose.json (truncated to the first 20 bytes). The deploy-time value is honored in all key-provider modes. |
| instance_id | The instance ID, determined by the SHA256 digest of the instance_id_seed || app_id (truncated to the first 20 bytes). Empty if no_instance_id is true in app-compose.json |
| instance_id_seed | The random seed that determines the instance ID |
| instance_id | The instance ID: the SHA256 digest of instance_id_seed \|\| app_id, followed on GCP and AWS by a per-instance platform binding, truncated to the first 20 bytes. Empty if no_instance_id is true in app-compose.json. The host supplies the seed, so the instance ID is unique only together with the app ID: identify an instance by the (app_id, instance_id) pair |
| instance_id_seed | The 20-byte random seed that determines the instance ID. Generated by the CVM when empty. A seed of another length is used as given, with a warning, so an existing CVM keeps its instance ID |

The hash of this file is not extended as a single measurement. Instead, the `app_id` and `instance_id` are extended as separate dstack launch events named `app-id` and `instance-id`. On TDX-family platforms those events go into RTMR3. On AWS NitroTPM they go into SHA384 PCR14.

Expand Down
9 changes: 9 additions & 0 deletions dstack/dstack-util/src/system_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3107,6 +3107,15 @@ impl<'a> Stage0<'a> {
getrandom::fill(&mut rand_id)?;
rand_id
};
} else if instance_info.instance_id_seed.len() != 20 {
// Still used as given: rejecting or replacing it would fail the boot
// or change the instance id of an existing CVM. The id is only
// unique together with the app id; a seed of another length makes
// even that depend on the platform binding.
warn!(
"instance_id_seed is {} bytes, expected 20",
instance_info.instance_id_seed.len()
);
}
let instance_id = if self.shared.app_compose.no_instance_id {
vec![]
Expand Down
10 changes: 9 additions & 1 deletion dstack/scripts/bin/dstack-cloud
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,15 @@ class CloudDeploymentManager:
return App()

with open(app_config_path, 'r') as f:
return App.from_dict(json.load(f))
app = App.from_dict(json.load(f))
# Older projects may carry another length, and changing it would change
# the instance id, so it is only reported.
if app.instance_id_seed and len(app.instance_id_seed) != 40:
logger.warning(
f"instance_id_seed in {APP_CONFIG_FILE} should be 20 bytes (40 hex chars), "
f"got {len(app.instance_id_seed)} chars"
)
return app

def save_app_config(self, app: App) -> None:
"""Save application configuration."""
Expand Down
Loading