Skip to content

UNOMI-976: Restrict Groovy action upload to system administrators - #852

Open
sergehuber wants to merge 1 commit into
masterfrom
UNOMI-976-groovy-action-authz
Open

UNOMI-976: Restrict Groovy action upload to system administrators#852
sergehuber wants to merge 1 commit into
masterfrom
UNOMI-976-groovy-action-authz

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Uploading a Groovy action puts code into the server process. That is a host-level operation rather
than something confined to one tenant's data plane, so GroovyActionsEndPoint now requires
UnomiRoles.ADMINISTRATOR on every path, including the multipart upload.

GroovyActionsServiceImpl also compiles through GroovyClassLoader.parseClass(codeSource, false)
rather than GroovyShell.parse. The distinction matters because GroovyShell.parse instantiates the
script, and instantiating a Groovy script is what evaluates its @field initializers. Saving an
action should compile it and nothing more; evaluating any part of a script's body belongs to
dispatch, not to storage. The emitted bytecode is otherwise identical, which was checked rather
than assumed.

testSaveCompilesWithoutInstantiating carries its own positive control: the same script is first run
through a plain GroovyShell and must set the marker. Without that step a probe that silently failed
to set it would make the real assertion pass while proving nothing.

Jira: https://issues.apache.org/jira/browse/UNOMI-976

Uploading a Groovy action puts code into the server process. That is a host-level operation rather
than something confined to one tenant's data plane, so GroovyActionsEndPoint now requires
UnomiRoles.ADMINISTRATOR on every path, including the multipart upload.

GroovyActionsServiceImpl also compiles through GroovyClassLoader.parseClass(codeSource, false)
rather than GroovyShell.parse. The distinction matters because GroovyShell.parse instantiates the
script, and instantiating a Groovy script is what evaluates its @field initializers. Saving an
action should compile it and nothing more; evaluating any part of a script's body belongs to
dispatch, not to storage. The emitted bytecode is otherwise identical, which was checked rather
than assumed.

testSaveCompilesWithoutInstantiating carries its own positive control: the same script is first run
through a plain GroovyShell and must set the marker. Without that step a probe that silently failed
to set it would make the real assertion pass while proving nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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