sysnet-audit
Sdílená Python knihovna pro auditní logování napříč FastAPI mikroslužbami SYSNET s.r.o.
pip install sysnet-audit
Distribuční název: sysnet-audit
Import path: audit_lib
Repozitář: github.com/SYSNET-CZ/audit
Quick start
from contextlib import asynccontextmanager
from fastapi import FastAPI, Depends
from audit_lib import (
init_audit, get_audit_backend, get_audit_logger,
AuditLogger, AuditActor, AuditResource, AuditSettings,
)
@asynccontextmanager
async def lifespan(app: FastAPI):
client = await init_audit(AuditSettings())
yield
await get_audit_backend().aclose()
if client is not None:
await client.aclose()
app = FastAPI(lifespan=lifespan)
@app.delete("/users/{user_id}")
async def delete_user(
user_id: str,
audit: AuditLogger = Depends(get_audit_logger),
):
await audit.log(
actor=AuditActor(sub="user-uuid"),
action="user.delete",
resource=AuditResource(type="user", id=user_id),
)
Proměnné prostředí
Prefix: AUDIT_
| Proměnná | Výchozí | Popis |
|---|---|---|
AUDIT_SERVICE_NAME |
— (povinné) | Identifikace mikroslužby |
AUDIT_MONGO_URI |
mongodb://localhost:27017 |
Connection string MongoDB |
AUDIT_MONGO_DB |
audit |
Název databáze |
AUDIT_ENABLED |
true |
Globální vypínač auditování |
AUDIT_KAFKA_BOOTSTRAP_SERVERS |
None |
Adresy Kafka brokerů (pro Topologii B) |
Vývoj a testování
git clone git@github.com:SYSNET-CZ/audit.git
cd audit
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install -e ".[dev,kafka]"
pytest
Licence
AGPLv3+ — SYSNET s.r.o.
Metadata
Release files for sysnet-audit 0.2.2
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 |
|---|---|---|---|---|
| sysnet_audit-0.2.2.tar.gz | 146.1 kB | Without provenance | Details for sysnet_audit-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sysnet_audit-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for sysnet_audit-0.2.2-py3-none-any.whl |
Total release size: 186.9 kB
Release files / sysnet_audit-0.2.2.tar.gz
| Download URL | sysnet_audit-0.2.2.tar.gz |
|---|---|
| Size | 146.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5fd3646e124ff221e5aedf687505765f2a7be5a9f3e771bf3e1398d912044db
|
|
BLAKE2b-256 checksum How to use checksums |
cc71129f40b5c7a0c635340e78d4863f6d7b69b61f32485c3c61d7e3be69ed71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / sysnet_audit-0.2.2-py3-none-any.whl
| Download URL | sysnet_audit-0.2.2-py3-none-any.whl |
|---|---|
| Size | 40.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc1849f11f7a0f1c6d40b4cbaaaa7310ab4f8f3a80bd005a6e054d2def49307f
|
|
BLAKE2b-256 checksum How to use checksums |
b2ce1890a13d11271491163ab1c26b504dcbaf8dba6ebb985895f2bce2aa9d3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for sysnet-audit 0.2.2
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.