Skip to content

Audit log and vault reveal log - #34

Merged
Installation-04 merged 7 commits into
mainfrom
claude/feature-audit-log
Nov 5, 2026
Merged

Installation-04 merged 7 commits into
mainfrom
claude/feature-audit-log

Conversation

@Installation-04

Copy link
Copy Markdown
Owner

Summary

  • Shared audit() helper (backend/src/lib/audit.js): never fails the request, redacts secret-looking keys, IP from req.ip (honours the existing trust proxy setting; X-Forwarded-For is never read directly), user agent clipped.
  • Recorded events: login success/failure (password and SSO), user create/register/role change/password change/email change/delete, SSO account link, Acumatica connect/disconnect, client delete, document download/delete, vault create/update/delete, and vault reveal/copy (who, which entry, when; never the secret).
  • GET /api/admin/audit (filters: user, action or prefix, from/to, text; pagination, page size capped at 200) and GET /api/admin/audit/export (CSV, formula-injection safe, itself audited). Admin only.
  • Per-entry vault history for admins: POST .../passwords/:id/reveal (any user, logs) and GET .../passwords/:id/audit (admin).
  • New "Journal d'audit" tab in Admin (AuditLog.jsx), filters, pagination, CSV export, dark mode, French UI. "Copier" button and Historique link added to the vault tab.
  • Retention: daily job purges rows older than AUDIT_RETENTION_DAYS (default 365, 0 = keep all); env passed through compose files and .env.example.
  • Schema: additive columns ip, user_agent, target_type, target_id plus indexes on audit_log.
  • Docs in docs/administration.md, CHANGELOG under Non publié (no version bump).

Tests

Full npm test on real Postgres: 213 pass, 0 fail (new backend/test/audit.test.js, frontend/test/audit.test.mjs). Frontend npm run build OK.

Notes

The vault list endpoint still returns all secrets to the browser (masked in the UI), so the reveal log reflects UI actions, not direct API reads. Documented.


Generated by Claude Code

Record security events through a shared non-failing helper, expose an
admin-only filtered/paginated API with CSV export, add a Journal d'audit
admin tab, per-entry vault access history, and a daily retention purge
(AUDIT_RETENTION_DAYS, default 365).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
…ues caused a 500)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
The list/create/update responses no longer carry the plaintext secret nor its
ciphertext, so unmasking or copying in the UI cannot happen without an audit
row. Editing leaves the password blank to keep it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
…60px)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
# Conflicts:
#	CHANGELOG.md
#	backend/src/db/schema.js
#	backend/src/lib/dailyJobs.js
@Installation-04
Installation-04 marked this pull request as ready for review November 5, 2026 03:12
# Conflicts:
#	CHANGELOG.md
@Installation-04
Installation-04 merged commit e3763bf into main Nov 5, 2026
6 checks passed
@Installation-04 Installation-04 mentioned this pull request Nov 5, 2026
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.

2 participants