Skip to content

feat(admin_audit): log structured parameters with audit entries - #65310

Open
GhassenKefi wants to merge 3 commits into
masterfrom
feat/admin-audit-structured-params
Open

GhassenKefi wants to merge 3 commits into
masterfrom
feat/admin-audit-structured-params

Conversation

@GhassenKefi

@GhassenKefi GhassenKefi commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@GhassenKefi GhassenKefi added this to the Nextcloud 36 milestone Oct 8, 2026
@GhassenKefi GhassenKefi self-assigned this Oct 8, 2026
@GhassenKefi
GhassenKefi requested a review from a team as a code owner October 8, 2026 10:27
@GhassenKefi
GhassenKefi requested review from CarlSchwan, leftybournes, provokateurin, salmart-dev, sorbaugh and susnux and removed request for a team October 8, 2026 10:27
@susnux susnux changed the title Feat/admin audit structured params feat(admin_audit): log structured parameters with audit entries Oct 13, 2026
ILogFactory::getCustomPsrLogger() gets an optional $structuredContext
flag. When set, array values of the log context are written as nested
data in the log entry instead of being encoded to a JSON string, so
consumers can read them as fields. Values used as message placeholders
are still converted to strings, and loggers without the flag, including
nextcloud.log, are unchanged.

Message interpolation now only replaces placeholders that occur in the
message, so array values that are not placeholders are never cast to
strings.

Refs nextcloud-gmbh/governance#198

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
Audit entries now carry the parameters they are built from as a nested
"params" object in their data (e.g. data.params.shareWith), so log
consumers no longer need to parse the human-readable message. Numbers
and booleans keep their type. Parameters are left out when the call
asks for obfuscation.

The audit logger requests a custom logger with structured context, so
only audit.log is affected.

Refs nextcloud-gmbh/governance#198

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
Log entries only recorded the user ID, which is hard to read in exports
and can't be matched once an account is renamed or deleted. Entries now
also contain "userDisplayName" next to "user" when a user is logged in
and the name can be resolved.

The name comes from IUserManager::getDisplayName(), which is cached. A
guard prevents recursion when the lookup itself writes a log entry, and
lookup failures leave the field out instead of breaking logging.

Refs nextcloud-gmbh/governance#198

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
@GhassenKefi
GhassenKefi force-pushed the feat/admin-audit-structured-params branch from 736654d to 371e5f1 Compare October 13, 2026 12:46

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants