feat: add kms_key_id for boot volume encryption and auto-detect security token (RPST) auth - #86
Merged
justintsteele merged 1 commit intoJun 25, 2026
Conversation
Adds support for encrypting the compute boot volume with a customer-managed Vault key via the new kms_key_id driver config, which is required by compartments governed by a Security Zone that mandates customer-managed encryption keys. Also detects security token (RPST) authentication automatically when the selected OCI profile contains a security_token_file, so sessions created by `oci session authenticate` work without explicitly setting use_token_auth. The existing use_token_auth flag remains supported. Includes rspec coverage for both features (KMS boot volume source details and token-auth signer selection) and documentation/CHANGELOG updates with a minor version bump to 3.1.0.
Collaborator
|
Acknowledged. Will review this week. Thank you for your submission! |
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.
Summary
This PR adds two related features that are needed to run Kitchen against compartments governed by an OCI Security Zone (which mandates customer-managed encryption) and to authenticate using ephemeral session tokens (RPST) such as those issued in CI pipelines.
1.
kms_key_id— customer-managed boot volume encryptionBy default OCI encrypts boot volumes with an Oracle-managed key. Security Zone policies often require a customer-managed (Vault) key instead, and instance creation is denied otherwise. A new optional compute config
kms_key_idis wired into theInstanceSourceViaImageDetails.kms_key_idof the launch request so the boot volume is encrypted with the supplied key at launch time.When unset, OCI's default encryption behavior is preserved (the attribute is
nil, identical to today's requests).2. Auto-detect security token (session/RPST) authentication
use_token_auth: truealready builds aSecurityTokenSigner. This PR additionally detects token auth automatically when the selected OCI profile contains asecurity_token_fileentry — even ifuse_token_authis not set. This makes sessions created byoci session authenticate(and short-lived RPST sessions exchanged in CI) work out of the box, without requiring auserin the profile.OCI::Configis always given thesecurity_token_fileaccessor so the SDK loads it from the profile.Api#signerselects the token signer whenuse_token_authis set or a usablesecurity_token_fileis present.use_token_authflag is unchanged and remains equivalent.Why
These changes upstream functionality we currently apply as runtime monkey-patches, so consumers can rely on the published gem instead. The KMS option unblocks Security Zone compartments; the token-auth detection unblocks keyless RPST sessions in automated pipelines.
Changes
lib/kitchen/driver/oci.rb: adddefault_config :kms_key_id, nillib/kitchen/driver/oci/instance/compute.rb: setkms_key_idon the image source detailslib/kitchen/driver/oci/config.rb: always exposesecurity_token_fileso it loads from the profilelib/kitchen/driver/oci/api.rb: auto-detect token auth viasecurity_token_fileREADME.md/CHANGELOG.md: document both features; version bump to3.1.0Test plan
bundle exec rake style— 41 files, no offensesbundle exec rake test— 48 examples, 0 failures (was 37)security_token_fileand nouser, both withuse_token_auth: trueand via auto-detectionkms_key_idis unset