SecureLog
SecureLog is a Python library designed to enhance the security of logging by preventing the leakage of sensitive information. It checks log messages for secrets and prints them securely, ensuring that sensitive data is not exposed in logs.
Features
- Secure Logging: Automatically checks log messages for secrets and prints them securely.
- Environment-Specific Configuration: Allows disabling console logging based on the environment variable value.
- Warning or Exit: Can be configured to either issue a warning or exit the process when a secret is detected.
Installation
To install SecureLog, use pip:
pip install secure-log==0.1.1
Usage
Basic Usage
To use SecureLog, simply import the SecureLog class and create an instance:
from secure_log import SecureLog
from secure_log import SecureLog
print = SecureLog().secure_print
You can override the default print function with secure_print or use secure_print directly for printing.
Configuration
You can configure SecureLog by passing an OptionsDict to the constructor. The OptionsDict can include the following keys:
disableOn: The environment variable value on which console logging should be disabled. This checks the value ofPYTHON_ENV. Expected type:str.warnOnly: IfTrue, only a warning is issued when a secret is detected in the log message. Otherwise, the process exits. Expected type:bool.
Example:
options = {
"disableOn": "production",
"warnOnly": True
}
secure_log = SecureLog(options=options)
secure_log.secure_print("This is a secure log message.")
Handling Potential Secrets Leak
If a secret is detected in a log message, SecureLog can either issue a warning or exit the process, depending on the warnOnly option.
secure_log.secure_print("This message contains a secret: SECRET_KEY")
Contributing
Contributions are welcome! Please read the contributing guidelines before getting started.
License
SecureLog is released under the MIT License.
Contact
For any questions or concerns, please open an issue on GitHub.
Metadata
Release files for secure-log 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| secure_log-0.1.1.tar.gz | 3.9 kB | Without provenance | Details for secure_log-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| secure_log-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for secure_log-0.1.1-py3-none-any.whl |
Total release size: 8.2 kB
Release files / secure_log-0.1.1.tar.gz
| Download URL | secure_log-0.1.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aafcc0c1fb1bb1d6f0202609a2b442d1d74e27b776849db86224863c8b2af106
|
|
BLAKE2b-256 checksum How to use checksums |
8a9dc668cd35d40a802bd5e29d0c1f03ad148dafa83bb0044b556dd9214bab6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Release files / secure_log-0.1.1-py3-none-any.whl
| Download URL | secure_log-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
327a0a906e70465c0eae86b8d2568c3aaf899e48d2f37fb93a5a5f0d6fe8338c
|
|
BLAKE2b-256 checksum How to use checksums |
ea8b86c3f8c2d82a0c235deb1fc75f3fe326b8d7ad644ee70d46865eb3ae9cb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Security for secure-log 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.