Skip to content

Feat/admin audit logging - #1578

Open
GhassenKefi wants to merge 4 commits into
mainfrom
feat/admin-audit-logging
Open

GhassenKefi wants to merge 4 commits into
mainfrom
feat/admin-audit-logging

Conversation

@GhassenKefi

Copy link
Copy Markdown

🤖 AI (if applicable)

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

@GhassenKefi GhassenKefi self-assigned this Oct 19, 2026
@GhassenKefi GhassenKefi added enhancement New feature or request 3. to review labels Oct 19, 2026
Creating, updating and deleting an OpenID Connect provider is now
written to the admin audit log, both from the admin settings and
through occ user_oidc:provider and user_oidc:provider:delete. An occ
call that only shows a provider is not logged.

The entries carry the provider ID and identifier, and for created and
updated providers the client ID and discovery endpoint. The client
secret is never logged: an update only records whether a new secret
was set (clientSecretChanged). An update also lists the keys of the
provider settings whose value changed (changedSettings), such as the
bearer token check or the group restriction, without their values.

The operations are collected in the new OCA\UserOIDC\AuditLog\Operation
enum, with a short description of each for the documentation, and are
dispatched through the new AuditLogger service.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
…t log

Enabling or disabling the login with ID4me and storing the tokens users
obtain at login (store_login_token) are now written to the admin audit
log with the new value.

The ID4me change is logged in ID4MeService::setID4ME, where the value
is stored. The login token storage is only logged for values the admin
settings actually store, so unsupported keys or non-boolean values are
not logged.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
An account created in this backend through the provisioning API
(OcsApiController::createUser), on the first request with a bearer
token of an unknown user, or on the first ID4me login is now written
to the admin audit log as user_oidc.user.provisioned, with the user
ID, the provider ID and the source of the provisioning
(provisioning_api, bearer_token or id4me_login). For ID4me, the
provider ID is the ID of the ID4me authority.

None of these paths dispatches a UserCreatedEvent, so the creation was
not visible in the audit log before. The OpenID Connect code flow login
is left out: it already dispatches UserCreatedEvent and the login
events, which admin_audit logs.

UserMapper::getOrCreate() now reports through an optional by-reference
argument whether it inserted the user, so an existing account, also one
known under another user ID than the token user ID, is not logged
again on every request.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
…t log

A code flow login that user_oidc rejects is now written to the admin
audit log as user_oidc.login.failed, with a short reason, the provider
ID when it is known and the user ID once it has been read from the ID
token. The reasons are idp_error, state_expired, state_mismatch,
token_request_failed, invalid_token (signature check failed),
token_expired, invalid_issuer, invalid_audience, invalid_azp,
invalid_nonce, missing_user_id, not_in_whitelisted_group,
user_conflict and provisioning_failed. None of these paths dispatches
AnyLoginFailedEvent, so they were not in the audit log before. The
authorization code, the tokens, the state and the error description of
the identity provider are never logged. A failure to decrypt the
client secret is not logged, as it is a configuration error and not a
rejected login.

A session revoked by a back-channel logout from the identity provider
is now logged as user_oidc.session.revoked with the user ID, the
provider and the ID of the revoked auth token. No core event logged by
admin_audit fires when the token is invalidated this way.

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-logging branch from fafcfd0 to da07e56 Compare October 20, 2026 15:46
@GhassenKefi

GhassenKefi commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

since user_oidc support NC29 and it uses php 8.0 tests won't pass because i'm using enum in the code base. All of the Psalm jobs share one psalm.xml with phpVersion="8.0", and the enum can’t parse under that. It clears once we raises the minimum php version.
@CarlSchwan

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

Labels

3. to review enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant