Skip to content

Allow reading the log via REST without superuser authorization (backport to 4.8) - #772

Merged
mederly merged 1 commit into
Evolveum:support-4.8from
martin-lizner:backport/read-log-authorization-4.8
Aug 18, 2026
Merged

Allow reading the log via REST without superuser authorization (backport to 4.8)#772
mederly merged 1 commit into
Evolveum:support-4.8from
martin-lizner:backport/read-log-authorization-4.8

Conversation

@martin-lizner

Copy link
Copy Markdown
Contributor

Backport of #769 to support-4.8.

Cherry-pick of 376ea6e. One conflict, in ModelDiagnosticService: on master getLogFileContent/getLogFileSize also throw SubscriptionComplianceException, which does not exist on this branch — resolved by keeping this branch's signatures and taking only the javadoc. Apart from that the added/removed lines are byte-identical to the master commit (same 10 files, +179 −4).

Not built or tested on this branch locally; on master TestRestServiceXml and TestRestServiceJson pass 74/74 with this change.

The REST endpoints GET /ws/rest/log and GET /ws/rest/log/size are already
guarded by fine-grained REST authorizations (authorization-rest-3#getLog
and #getLogSize). However, the underlying model operations
ModelDiagnosticService.getLogFileContent() and getLogFileSize() called
securityEnforcer.authorizeAll(), i.e. they required authorization-3#all.
The effect was that only a superuser could read the log, and the
fine-grained REST authorizations were unusable in practice: a read-only
administrator could not be granted access to the log at all.

This adds a new model authorization action

    http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#readLog

and uses it in ModelDiagController instead of authorizeAll(). This follows
the existing #readThreads pattern used for the thread dump operations, and
the note in ExtensionSchemaRestController about combining a specific REST
action with a specific model action instead of "all".

A single model action covers both the content and the size operations: the
size is strictly less information than the content, and clients are
expected to use them together (see the ReturnedDataPosition /
CurrentLogFileSize response headers). Deployments that want to expose only
one of the two endpoints can still do so via the REST-level authorizations.

The change is backward compatible: #all is applicable to any action, so
existing superusers are unaffected.

Also adds REST integration tests for both endpoints - they had no test
coverage at all - and documents the required authorization on the service
interface.

The other authorizeAll() call sites in ModelDiagController (memory
information, repository diagnostics, etc.) are deliberately left unchanged.

(cherry picked from commit 376ea6e)
@mederly
mederly merged commit 0bcdcd0 into Evolveum:support-4.8 Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants