Add mock file audit backend

This commit is contained in:
2026-06-01 23:44:03 +02:00
parent a3129afa42
commit afa15cd1b9
9 changed files with 353 additions and 1 deletions

24
Makefile Normal file
View File

@@ -0,0 +1,24 @@
SHELL := /usr/bin/env bash
.DEFAULT_GOAL := help
AUDIT_CORE_MOCK_DIR ?= /tmp/audit-core
test: ## Run unit tests
python3 -m pytest -q
mock-audit-smoke: ## Write one non-secret smoke event to the mock audit backend
AUDIT_CORE_MOCK_DIR="$(AUDIT_CORE_MOCK_DIR)" python3 -m audit_core emit \
--source audit-core \
--action audit_core.mock_backend.smoke \
--resource "$(AUDIT_CORE_MOCK_DIR)" \
--outcome success \
--detail backend=mock-file
mock-audit-cleanup: ## Remove mock audit files older than the retention window
AUDIT_CORE_MOCK_DIR="$(AUDIT_CORE_MOCK_DIR)" python3 -m audit_core cleanup
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} \
/^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
.PHONY: test mock-audit-smoke mock-audit-cleanup help