Secrets
Module for secret integrations.
Contains abstract class for various secret integrations also known as SecretContext.
koheesio.secrets.Secret #
Abstract class for various secret integrations. All secrets are wrapped into Context class for easy access. Either existing context can be provided, or new context will be created and returned at runtime.
Secrets are wrapped into the pydantic.SecretStr.
context
class-attribute
instance-attribute
#
context: Optional[Context] = Field(
Context({}),
description="Existing `Context` instance can be used for secrets, otherwise new empty context will be created.",
)
parent
class-attribute
instance-attribute
#
parent: Optional[str] = Field(
default=...,
description="Group secrets from one secure path under this friendly name",
pattern="^[a-zA-Z0-9_]+$",
)
root
class-attribute
instance-attribute
#
root: Optional[str] = Field(
default="secrets",
description="All secrets will be grouped under this root.",
)
Output #
encode_secret_values
classmethod
#
encode_secret_values(data: dict)
Encode secret values in the dictionary.
Ensures that all values in the dictionary are wrapped in SecretStr.
Source code in src/koheesio/secrets/__init__.py
execute #
Main method to handle secrets protection and context creation with "root-parent-secrets" structure.