[STACKED on #873] fix(kms): persist private keys owner-only - #874
Merged
Conversation
kvinwang
force-pushed
the
codex/fix-kms-private-key-permissions
branch
from
August 3, 2026 14:53
062a2a7 to
88201a4
Compare
kvinwang
force-pushed
the
codex/fix-kms-private-key-permissions
branch
from
August 3, 2026 16:39
88201a4 to
51f7c85
Compare
Upgrade safe-write to 0.1.3 and use its Unix mode-aware atomic write API for KMS private keys. Root CA, temporary CA, RPC, and K256 keys are created with mode 0600 without duplicating the atomic-write implementation in KMS.
kvinwang
force-pushed
the
codex/fix-kms-private-key-permissions
branch
from
August 3, 2026 16:46
51f7c85 to
44cd5ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
KMS wrote private-key files with permissions derived from the generic
safe_write()path. A permissive environment could leave CA or service private keys readable by other local users.Fix
The upstream
safe-writecrate now provides:Version
0.1.3has been published to crates.io and tagged asv0.1.3upstream. KMS now uses that API with mode0o600for:This keeps atomic-write behavior centralized in its owning crate instead of duplicating it in KMS.
Changed paths
dstack/Cargo.tomldstack/Cargo.lockdstack/kms/src/onboard_service.rsDependency and merge order
codex/fix-kms-bootstrap-onceVerification
safe-write: all unit and documentation tests passed.cargo publish --dry-run: passed.safe-write v0.1.3: published successfully to crates.io.cargo test -p dstack-kms onboard_service::tests --no-fail-fast: passed.cargo fmt --all -- --check: passed.git diff --check: passed.