A Prefect block for interacting with Keeper Security's Secrets Manager.
This project provides a custom Prefect block that allows interaction with Keeper Security's Secrets Manager. It enables secure retrieval of secrets stored in Keeper by record UID or record title within Prefect workflows.
- Seamless integration with Keeper Security's Secrets Manager
- Retrieve secrets by record UID or record title
- Secure handling of KSM configuration
- Easy configuration and intuitive usage
To install this package, use the following command:
uv add prefect-keeperBefore using the block, ensure that you have a valid KSM (Keeper Secrets Manager) configuration. The configuration should be provided as a base64 encoded string.
To save the Keeper block :
from prefect_keeper import Keeper
from pydantic import SecretStr
# Initialize the Keeper block with your KSM configuration
keeper = Keeper(ksm_config=SecretStr("your-base64-encoded-config"))
# Save the block
keeper.save("my-keeper-block", overwrite=True)To load a previously saved block and use its methods:
from prefect import flow
from prefect_keeper import Keeper
@flow
def example_flow():
# Load the saved block
keeper = Keeper.load("my-keeper-block")
# Retrieve a secret by record UID
record = keeper.get_record_by_uid("record-uid-123")
print(f"Record by UID: {record}")
# Retrieve a secret by record title
record = keeper.get_record_by_title("My Secret Title")
print(f"Record by Title: {record}")
if __name__ == "__main__":
example_flow()The block can be configured with the following parameters:
ksm_config: The KSM config provided as a base64 encoded string. This is a required field and should be provided as aSecretStrfor security.
from prefect_keeper import Keeper
from pydantic import SecretStr
keeper = Keeper(
ksm_config=SecretStr("your-base64-encoded-config")
)- Python 3.10+
- Uv for dependency management
- Access to Keeper Security's Secrets Manager
- Clone the repository:
git clone https://github.com/patacoing/prefect-keeper.git
cd prefect-keeper- Install dependencies:
uv syncThis project uses just as a way to save and run project-specific commands.
You can go to justfile or run just -l to display all available recipes
Contributions are welcome! Please open an issue or a pull request for any improvements or fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.