Registry / auth-security / cerberus-python-client

cerberus-python-client

JSON →
library2.5.4pypypi✓ verified 27d ago

Cerberus Python Client is a library for programmatically interacting with Cerberus, Nike's secret management system. It facilitates secure communication via HTTPS, supporting AWS and Cerberus-specific authentication methods. As of version 2.5.4, it primarily supports read-only operations, with write functionality not yet implemented by the maintainers. While the library is stable, its official GitHub repository was archived in January 2024, indicating that active development has ceased.

pip install cerberus-python-client
INSTALL
IMPORT
SIG · CERBERUS-PYTHON-CL
C
cerberus-python-client
auth-securitypythonv2.5.4
Install
4.2s avg
Import
654ms
Disk
52MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.5.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.676s · 53.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 4.2s · import 0.632s · 54MB
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CerberusClient
✓ from cerberus.client import CerberusClient

This quickstart demonstrates how to initialize the `CerberusClient` using IAM Role or User authentication and then retrieve secrets and files. For IAM Role authentication, ensure the execution environment has the necessary AWS IAM permissions. For User authentication, set `CERBERUS_USERNAME` and `CERBERUS_PASSWORD` environment variables.

import os from cerberus.client import CerberusClient CERBERUS_URL = os.environ.get('CERBERUS_URL', 'https://cerberus.example.com') # For local development, you might set these via environment variables or pass directly CERBERUS_USERNAME = os.environ.get('CERBERUS_USERNAME', '') CERBERUS_PASSWORD = os.environ.get('CERBERUS_PASSWORD', '') try: # Example 1: IAM Role Authentication (typical for EC2, ECS, Lambda) # Requires appropriate IAM role attached to the execution environment client_iam = CerberusClient(CERBERUS_URL) print(f"IAM Client initialized: {client_iam.cerberus_url}") # Example 2: User Authentication (for local development or specific use cases) if CERBERUS_USERNAME and CERBERUS_PASSWORD: client_user = CerberusClient(CERBERUS_URL, CERBERUS_USERNAME, CERBERUS_PASSWORD) print(f"User Client initialized: {client_user.cerberus_url}") # Example: Reading a secret (replace with your actual secret path) secret_path = 'app/my-application/my-secret-key' try: secret_data = client_iam.get_secret(secret_path) print(f"Retrieved secret from {secret_path}: {secret_data}") except Exception as e: print(f"Error retrieving secret {secret_path}: {e}") # Example: Reading a file (replace with your actual file path) file_path = 'app/my-application/path/to/my-file.txt' try: file_content = client_iam.get_file(file_path) print(f"Retrieved file from {file_path}, content type: {type(file_content)}") # If it's text, you can decode: # print(f"File content: {file_content.decode('utf-8')}") except Exception as e: print(f"Error retrieving file {file_path}: {e}") except Exception as e: print(f"Failed to initialize CerberusClient: {e}") print("Ensure CERBERUS_URL and appropriate authentication (IAM role or credentials) are configured.")
Debug
Known issues
breakingThe official GitHub repository for `cerberus-python-client` (Nike-Inc/cerberus-python-client) was archived by its owner on January 12, 2024, and is now read-only. This indicates that active development and maintenance have ceased. While existing versions remain available on PyPI, no new features, bug fixes, or official support are expected.
fix
Be aware that the library is no longer actively maintained. For critical projects, consider the implications of using an unmaintained library or explore alternative secret management solutions.
affects: All versions (future impact)
gotchaThis library (`cerberus-python-client`) is distinct from the general-purpose Python data validation library `Cerberus`. They share a similar name but serve entirely different purposes. Importing or referring to the wrong library can lead to unexpected errors.
fix
Always use `pip install cerberus-python-client` for the client library and `from cerberus.client import CerberusClient`. For the data validation library, use `pip install Cerberus` and `from cerberus import Validator`.
affects: All versions
gotchaWhen uploading files to Cerberus, ensure that the file is opened in binary mode (`'rb'`). Failure to do so can result in incorrect size calculations and corrupted uploads.
fix
Always open files for upload using `with open('your_file.txt', 'rb') as f: ...`
affects: All versions
gotchaCerberus is generally not recommended for storing secrets directly accessed by AWS Lambda functions, due to potential issues with scale (thousands of requests per second) and additional latency introduced by authentication and secret retrieval.
fix
For Lambda functions, consider using AWS Secrets Manager or Parameter Store for better integration, scale, and performance.
affects: All versions
gotchaPrior to version 2.5.2, users might encounter issues if the `cerberus_url` passed to `CerberusClient` had an inconsistent trailing slash. Version 2.5.2 introduced a fix to remove the trailing slash during initialization, making the client more robust to user input.
fix
Upgrade to `cerberus-python-client` version 2.5.2 or newer to automatically handle trailing slashes in the Cerberus URL. If using an older version, manually ensure the URL does not end with a trailing slash.
affects: < 2.5.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cerberus-python-client'
The `cerberus-python-client` library has not been installed in your Python environment or the import statement is incorrect.
fix
Install the library using pip: `pip install cerberus-python-client`
ModuleNotFoundError: No module named 'cerberus'
You are trying to import the `cerberus` data validation library, but you intended to use the `cerberus-python-client` library which is a separate package.
fix
If you meant to use the Cerberus Python Client, install `cerberus-python-client` and import `CerberusClient` from `cerberus.client`: `from cerberus.client import CerberusClient`. If you intended to use the `cerberus` data validation library, install it with `pip install cerberus` and import `Validator` from `cerberus`: `from cerberus import Validator`.
CerberusClientException: Unable to locate AWS credentials
The `cerberus-python-client` cannot find valid AWS credentials in the environment to authenticate with Cerberus, which is necessary for AWS IAM Role authentication.
fix
Ensure your AWS environment variables (e.g., `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`), shared credentials file (`~/.aws/credentials`), or IAM role are correctly configured and accessible to the application. You might also need to specify the `region` when initializing `CerberusClient` or `AWSAuth`.
Failed to authenticate
The client could not successfully authenticate with the Cerberus service, which can be due to invalid credentials, incorrect URL, or network issues.
fix
Verify the `cerberus_url`, `username`, `password`, `region`, or `token` provided to the `CerberusClient` constructor are correct. Check network connectivity to the Cerberus instance and ensure your authentication method (e.g., user/pass, AWS IAM role) is properly configured.
Upgrade
Version history
2.5.4latest on PyPI · released Oct 6, 2022
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the Cerberus API.
boto3requiredRequired for AWS IAM Role and STS assumed role authentication.
Agent activity
66 hits · last 30 days
node
62
Bingbot
1
OpenAI (training)
1
Resources