[VS-NfD] Add a retention job for audit_log #196

Closed
opened 2026-07-30 01:43:33 +02:00 by fable-5 · 1 comment
Collaborator

Plan reference: 20-massnahmenplan.md -> Phase 2
ADR: n/a
Effort: S (1 AT)
Depends on:

Context

An audit trail without a retention rule grows without bound and conflicts
with data-protection requirements the operator has to answer for. A
configurable period is also what the IT-Grundschutz mapping (#230) needs
to reference.

Current state

  • audit_log is the AuditEntry model
    (apps/api/prisma/schema.prisma:74–91, issue #86), written by
    apps/api/src/audit/audit.service.ts in addition to the audit: …
    stdout line.
  • No retention or pruning job for the table exists.

Acceptance criteria

  • Retention period is configurable (instance setting or env, matching
    the pattern used for backup retention) with a documented default.
  • A scheduled job deletes entries past the period; the deletion itself
    is logged (count, cutoff) so the gap is explainable.
  • Test: entries older than the cutoff are removed, newer ones stay.
  • The read-access trail (#224) is explicitly not covered by this
    job — it gets its own period.
  • A logging section of docs/architecture/security.md and #229
    document the period. Note: the file has no logging section
    today, although apps/api/prisma/schema.prisma:69 already cites
    "security.md §Logging" — creating it is part of this issue.

Out of scope

Export of audit entries to a SIEM (#201) and the read-access trail (M6).

**Plan reference:** `20-massnahmenplan.md` -> Phase 2 **ADR:** n/a **Effort:** S (1 AT) **Depends on:** — ## Context An audit trail without a retention rule grows without bound and conflicts with data-protection requirements the operator has to answer for. A configurable period is also what the IT-Grundschutz mapping (#230) needs to reference. ## Current state - `audit_log` is the `AuditEntry` model (`apps/api/prisma/schema.prisma:74–91`, issue #86), written by `apps/api/src/audit/audit.service.ts` in addition to the `audit: …` stdout line. - No retention or pruning job for the table exists. ## Acceptance criteria - [ ] Retention period is configurable (instance setting or env, matching the pattern used for backup retention) with a documented default. - [ ] A scheduled job deletes entries past the period; the deletion itself is logged (count, cutoff) so the gap is explainable. - [ ] Test: entries older than the cutoff are removed, newer ones stay. - [ ] The read-access trail (#224) is explicitly **not** covered by this job — it gets its own period. - [ ] A logging section of `docs/architecture/security.md` and #229 document the period. **Note:** the file has **no** logging section today, although `apps/api/prisma/schema.prisma:69` already cites "security.md §Logging" — creating it is part of this issue. ## Out of scope Export of audit entries to a SIEM (#201) and the read-access trail (M6).
fable-5 added this to the M24 — VS-NfD: security quick wins milestone 2026-07-30 01:43:33 +02:00
fable-5 added the
effort:S
area:storage
vs-nfd
labels 2026-07-30 01:43:33 +02:00
Author
Collaborator

Delivered by PR #251 (ed2225b), merged to main fast-forward. CI run 500 green. Closing.

Delivered by PR #251 (ed2225b), merged to main fast-forward. CI run 500 green. Closing.
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stwaidele/dorfteich#196
No description provided.