Keeper Secrets Manager SDK storage integration with Oracle Cloud KMS for encrypted key-value storage.
Project description
Oracle KMS
Keeper Secrets Manager integrates with Oracle KMS in order to provide protection for Keeper Secrets Manager configuration files. With this integration, you can protect connection details on your machine while taking advantage of Keeper's zero-knowledge encryption of all your secret credentials.
Features
- Encrypt and Decrypt your Keeper Secrets Manager configuration files with Oracle KMS
- Protect against unauthorized access to your Secrets Manager connections
- Requires only minor changes to code for immediate protection. Works with all Keeper Secrets Manager Python SDK functionality
Prerequisites
- Supports the Python Secrets Manager SDK
- Requires
ocipackage - These are permissions required for Oracle Cloud service account:
- KMS CryptoKey Decrypter
- KMS CryptoKey Encrypter
- KMS CryptoKey Public Key Viewer
Setup
- Install KSM Storage Module
The Secrets Manager Oracle KMS module can be installed using pip
pip3 install keeper-secrets-manager-storage-oracle-kms
- Configure Oracle Cloud Connection
By default the oci library will utilize the default connection session setup located at ~/.oci/config.
See the Oracle Cloud documentation for more information on setting up an OCI session: https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm
Alternatively, configuration variables can be provided explicitly using the OCISessionConfig data class and providing a path to the service account json file, profile name, and KSM endpoint name.
You will need an Oracle Cloud service account to use the Oracle KMS integration.
For more information on Oracle Cloud service accounts see the Oracle Cloud documentation: https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/managingcredentials.htm
- Add Oracle KMS Storage to Your Code
Now that the Oracle Cloud connection has been configured, you need to tell the Secrets Manager SDK to utilize the Oracle KMS as storage.
To do this, use OracleKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an Oracle Key ID, key version ID, as well as the name of the Secrets Manager configuration file which will be encrypted by Oracle KMS.
from keeper_secrets_manager_storage_oracle_kms import OracleKeyValueStorage, OCISessionConfig
from keeper_secrets_manager_core import SecretsManager
config_file_location = "/home/<user>/.oci/config"
profile = "DEFAULT"
kms_crypto_endpoint = "https://<kmsendpoint>.oraclecloud.com"
kms_mgmt_endpoint = "https://<kmsendpoint>.oraclecloud.com"
key_id = '<key_id>'
key_version_id = "<key_version_id>"
config_path = "<path to config json>"
one_time_token = "<OTT>"
oci_session_config = OCISessionConfig(config_file_location, profile, kms_crypto_endpoint, kms_mgmt_endpoint)
storage = OracleKeyValueStorage(key_id=key_id, key_version=key_version_id, config_file_location=config_path, oci_session_config=oci_session_config, logger=None)
secrets_manager = SecretsManager(token=one_time_token, config=storage)
all_records = secrets_manager.get_secrets()
first_record = all_records[0]
print(first_record)
Change Key
If you want to change the key from previous configuration, you can use the change_key method.
storage = OracleKeyValueStorage(key_id=key_id, key_version=key_version_id, config_file_location=config_path, oci_session_config=oci_session_config, logger=None)
key_id_2 = "<second key id>"
key_version_id_2 = "<second key version>"
is_changed = storage.change_key(key_id_2, key_version_id_2)
print("Key is changed:", is_changed)
Decrypt Config
You can use this method to decrypt the config file. This is not recommended for production use.
storage = OracleKeyValueStorage(key_id=key_id, key_version=key_version_id, config_file_location=config_path, oci_session_config=oci_session_config, logger=None)
# Extract only plaintext
plaintext = storage.decrypt_config(False)
print(plaintext)
# OR extract plaintext and save config as plaintext
plaintext = storage.decrypt_config(True)
print(plaintext)
You're ready to use the KSM integration 👍
Using the Oracle KMS Integration
Once setup, the Secrets Manager Oracle KMS integration supports all Secrets Manager Python SDK functionality. Your code will need to be able to access the Oracle KMS APIs in order to manage the decryption of the configuration file when run.
Change Log
1.1.0
Requirements:
- Minimum Python version raised to 3.9.2 (effective floor;
cryptography>=46.0.5excludes 3.9.0 and 3.9.1 — users on exactly those patch versions will hit a pip resolver error); users on Python 3.6–3.8 should pin to<1.1.0 - Minimum
keeper-secrets-manager-coredependency raised to 17.2.1 - Minimum
ociraised to 2.174.0 on Python 3.10+ and pinned to 2.167.3–2.168.1 on Python 3.9. Required because olderocireleases capcryptography<46.0.0, which would block the CVE-2026-26007 remediation below. If your environment pinsoci, update to a compatible range before upgrading.
Security:
- KSM-834: Fixed CVE-2026-26007 —
cryptographyupgraded to ≥46.0.5 (ECDH subgroup attack on SECT curves, HIGH CVSS 8.2) - KSM-954: Fixed AES-GCM nonce length from 128-bit (pycryptodome default) to 96-bit per NIST SP 800-38D; existing encrypted blobs remain readable
- KSM-954: Replaced MD5 with SHA-256 for config change detection
urllib3upgraded to 2.6.3 (CVE-2026-47081),requeststo 2.32.4
Bug fixes:
- KSM-950:
OracleKeyValueStorage.__init__()no longer writes plaintext{}to disk before encryption succeeds, and KMS failures during the initialget_key/encrypt_buffercall now propagate instead of being silently swallowed - KSM-951:
encrypt_buffer()anddecrypt_buffer()now raise on KMS failure instead of returning empty bytes/string; callers (set,save_storage,delete) reliably see the failure - KSM-952:
delete_all()now removes the credential file from disk viaos.remove()instead of re-encrypting an empty config and leaving the file in place - KSM-953:
set()on a read-only config file now propagatesPermissionErrorinstead of silently leaving in-memory state ahead of disk state - KSM-955:
read_storage()now returns a defensive copy of the config dict instead of a live reference; caller mutations no longer silently corrupt internal state - KSM-955:
decrypt_config()autosave default changed fromTruetoFalse— a call without arguments no longer writes plaintext credentials to disk. Passautosave=Trueexplicitly to preserve the previous behavior - KSM-956:
OracleKeyValueStorageis now thread-safe for concurrentset(),delete(),change_key(), anddecrypt_config()calls via an internalthreading.RLock - KSM-957:
load_config()no longer leavesself.config = Noneafter bootstrapping from an empty JSON{}config file; subsequentget/set/deleteno longer crash withTypeError: 'NoneType' object is not iterable
1.0.0
- Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keeper_secrets_manager_storage_oracle_kms-1.1.0.tar.gz.
File metadata
- Download URL: keeper_secrets_manager_storage_oracle_kms-1.1.0.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eec7dd128c41aea3316a1c6a4df13aae6e668d49636c1426dd294b9ad1fa42c6
|
|
| MD5 |
3bf3300bac7f094d402d9564f0f9f159
|
|
| BLAKE2b-256 |
dbcc90846c3783cd52e173992db78ee31c0b0b76880808315f4bec99f2873881
|
Provenance
The following attestation bundles were made for keeper_secrets_manager_storage_oracle_kms-1.1.0.tar.gz:
Publisher:
publish.pypi.sdk.storage.oracle.kms.yml on Keeper-Security/secrets-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keeper_secrets_manager_storage_oracle_kms-1.1.0.tar.gz -
Subject digest:
eec7dd128c41aea3316a1c6a4df13aae6e668d49636c1426dd294b9ad1fa42c6 - Sigstore transparency entry: 1586540101
- Sigstore integration time:
-
Permalink:
Keeper-Security/secrets-manager@8ec2a4be59cb6e13f0364a12ace8a6fb1413a992 -
Branch / Tag:
refs/heads/release/storage/python/oracle-kms/v1.1.0 - Owner: https://github.com/Keeper-Security
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.pypi.sdk.storage.oracle.kms.yml@8ec2a4be59cb6e13f0364a12ace8a6fb1413a992 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file keeper_secrets_manager_storage_oracle_kms-1.1.0-py3-none-any.whl.
File metadata
- Download URL: keeper_secrets_manager_storage_oracle_kms-1.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f31f79856fe8231240e104b42b62b46ab901bee96ec80b9e07ae64e791d7a50
|
|
| MD5 |
2d4b44fd85cb201061abae90afc9d0ca
|
|
| BLAKE2b-256 |
4140729856f7480244d4245c10f8da571e583249ae77260578f40a72e73896fa
|
Provenance
The following attestation bundles were made for keeper_secrets_manager_storage_oracle_kms-1.1.0-py3-none-any.whl:
Publisher:
publish.pypi.sdk.storage.oracle.kms.yml on Keeper-Security/secrets-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keeper_secrets_manager_storage_oracle_kms-1.1.0-py3-none-any.whl -
Subject digest:
3f31f79856fe8231240e104b42b62b46ab901bee96ec80b9e07ae64e791d7a50 - Sigstore transparency entry: 1586540128
- Sigstore integration time:
-
Permalink:
Keeper-Security/secrets-manager@8ec2a4be59cb6e13f0364a12ace8a6fb1413a992 -
Branch / Tag:
refs/heads/release/storage/python/oracle-kms/v1.1.0 - Owner: https://github.com/Keeper-Security
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.pypi.sdk.storage.oracle.kms.yml@8ec2a4be59cb6e13f0364a12ace8a6fb1413a992 -
Trigger Event:
workflow_dispatch
-
Statement type: