Skip to content

feat: audit logging - #1607

Merged
marcelklehr merged 4 commits into
mainfrom
feat/admin-audit-logging
Nov 5, 2026
Merged

marcelklehr merged 4 commits into
mainfrom
feat/admin-audit-logging

Conversation

@marcelklehr

Copy link
Copy Markdown
Member

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

Changing a Recognize setting through SettingsService::setSetting (the
admin settings page) now writes a `recognize.setting.changed` entry with
the setting key, the new value and the previous value. The values are
booleans, numbers and binary paths; none of them are secrets. The binary
paths (node, ffmpeg) are executed by the app, so their new value is part
of the entry.

Only actual changes are logged: the admin page re-submits every setting
on each save, so writing an unchanged value produces no entry. Progress
state that the background jobs write through the same method
(*.status, *.lastFile, clusterFaces.lastRun) is not configuration and is
not logged. Settings changed with occ config:app:set bypass this service
and are covered by the occ command line entry admin_audit writes itself.

All entries are built by AuditEventFactory, which passes the operation
only to servers whose CriticalActionPerformedEvent supports it.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
…t log

Resetting data of all users now writes an audit entry:

- recognize.classifications.reset: TagManager::resetClassifications
  removed the Recognize classification tags from all files (admin page
  "reset tags", occ recognize:reset-tags), with the number of files.
- recognize.face_clusters.deleted_all: FaceClusterMapper::deleteAll
  deleted every face cluster (admin page "reset faces",
  occ recognize:reset-faces, occ recognize:reset-face-clusters), with
  the number of deleted rows.
- recognize.face_detections.deleted_all: FaceDetectionMapper::deleteAll
  deleted every face detection (admin page "reset faces",
  occ recognize:reset-faces), with the number of deleted rows.

The admin controller and the occ commands call the mappers directly, so
the mappers are the one place that covers every entry point. Resetting
faces therefore writes one entry per table. Nothing is logged when there
was nothing to delete or when the deletion failed.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
… log

The occ commands that delete system tags now write an audit entry:

- recognize.empty_tags.deleted: TagManager::removeEmptyTags
  (occ recognize:cleanup-tags) deleted every system tag that is assigned
  to no file. This includes tags created by admins or other apps, not
  only Recognize's.
- recognize.legacy_tags.deleted: TagManager::removeTags
  (occ recognize:remove-legacy-tags) deleted the tags of old Recognize
  versions.

Both entries carry the number of deleted tags and their IDs. Tag names
are not logged. admin_audit logs the creation of system tags but not
their deletion, and the occ command line alone does not show which tags
were removed. One entry is written per command run, only after all
deletions succeeded and only if at least one tag was deleted.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
…t log

Clearing all queues and scheduling a recrawl now writes an audit entry:

- recognize.queues.cleared: QueueService::clearAllJobs emptied every
  queue and removed all scheduled Recognize background jobs (admin page,
  occ recognize:clear-background-jobs).
- recognize.recrawl.scheduled: QueueService::scheduleRecrawl did the
  same and scheduled a new crawl of all files (admin page,
  occ recognize:recrawl).

Both entries carry the number of removed queue entries. A recrawl writes
only its own entry, not an additional one for the clearing.

The admin controller and both occ commands repeated the same list of
queues and jobs; they now call these two service methods, so every entry
point writes the same entry once and only after all steps succeeded.
This also makes occ recognize:clear-background-jobs remove the face
clustering job, as the admin page and the recrawl already did.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr force-pushed the feat/admin-audit-logging branch from 3dbd2b7 to c99718d Compare November 4, 2026 13:51
@marcelklehr
marcelklehr merged commit b9a4cf9 into main Nov 5, 2026
42 checks passed
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