Skip to content

refactor(auth): deepen audit-log verification behind a shared core - #145

Merged
allisson merged 2 commits into
mainfrom
improve-codebase
Aug 9, 2026
Merged

refactor(auth): deepen audit-log verification behind a shared core#145
allisson merged 2 commits into
mainfrom
improve-codebase

Conversation

@allisson

@allisson allisson commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Pull Request

Summary

  • Deepen audit-log signature verification: extract the single verify-one-log core (verifyAuditSignature + a signatureStatus enum) that both VerifyIntegrity (single) and VerifyBatch (batch) route through, so the tamper-detection logic has one locality instead of two divergent copies.
  • Behavior fix (divergence): batch verification previously lumped KEK-missing logs into invalid_count. It now reports them in their own kek_missing_count / kek_missing_logs bucket, agreeing with single-log verification (ErrKekNotFoundForLog). A KEK-missing log still fails the integrity check (it cannot be proven authentic) — only the classification differs.
  • Add the first focused unit test surface for the tamper path (valid / tampered / legacy-unsigned / KEK-missing) and a batch KEK-missing classification test.
  • CLI verify-audit-logs text + JSON output gains the Kek Missing / kek_missing_* fields.

Validation

  • Relevant tests pass locally: go test ./internal/auth/... ./cmd/...
  • Integration TestAuditLogSignature passes against Postgres (make test-db-up / go test -tags integration ./test/integration/ -run TestAuditLogSignature / make test-db-down)
  • go build ./..., go vet, gofmt clean

Documentation Quality Gate

  • Documentation updated for behavior/contract changes (docs/cli-commands.md JSON example)
  • Last updated metadata refreshed in changed docs pages — n/a, no such metadata in docs/cli-commands.md
  • CHANGELOG.md updated for significant docs changes — added an Unreleased entry
  • make docs-lint passes locally — not run (docker-dependent)
  • Examples/commands were validated or reviewed for accuracy

@allisson
allisson merged commit 226ac9b into main Aug 9, 2026
3 checks passed
@allisson
allisson deleted the improve-codebase branch August 9, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant