Skip to content

Declare a permission on API operations that had none - #588

Open
pacmano1 wants to merge 2 commits into
OpenIntegrationEngine:mainfrom
pacmano1:operation-permission-labels
Open

pacmano1 wants to merge 2 commits into
OpenIntegrationEngine:mainfrom
pacmano1:operation-permission-labels

Conversation

@pacmano1

Copy link
Copy Markdown
Contributor

19 API operations declared no permission in @MirthOperation, so an authorization controller had nothing to check for them. Each now declares an existing permission:

Operations Permission
Connector tests (Document Writer, File Reader and Writer, HTTP, TCP, SMTP and Web Service senders), the Web Service WSDL operations, Database getTables, JMS template save and delete manageChannels
JMS getTemplates, getTemplate viewChannels
getProperty viewServerSettings
setUpdateSettings editServerSettings

Also:

  • JMS deleteTemplate was declared with the operation name saveTemplate, and its API summary described a save.
  • New MirthOperationPermissionTest walks every @MirthOperation in the core API, connectors and bundled plugins. It fails when one declares no permission and isn't on the test's list of operations that need none (each listed with its reason), and when a list entry matches no such operation or more than one overloaded method.

Left out on purpose

These still declare no permission and are on the test's list:

  • The four message audit operations (auditAccessedPHIMessage, auditQueriedPHIMessage, auditExportMessages, auditExportMessagesSuccess). The client calls them to record that a user viewed, searched or exported messages. Whether that auditing belongs on the server is its own question.
  • The user preference operations and setUserNotificationAcknowledged. Every user reads and writes their own preferences through them, so a permission there is a separate change.

How to verify

./gradlew :server:test --tests com.mirth.connect.client.core.api.MirthOperationPermissionTest: on main it fails and lists the 19; on this branch it passes.

Tested

  • ./gradlew clean build: 918 tests, 0 failures.
  • Main and this branch booted on Derby with the stock authorization controller: every labelled operation I called as admin gave the same response on both.
  • While I normally run all databases, there is no database change in this PR, so I ran Derby only.

Co-authored with Claude Code.

pacmano1 and others added 2 commits November 17, 2026 13:01
19 API operations declared no permission in @MirthOperation, so an
authorization controller had nothing to check for them. Each now
declares an existing permission:

- manageChannels: the connector test operations (Document Writer, File
  Reader and Writer, HTTP, TCP, SMTP and Web Service senders), the Web
  Service WSDL operations, Database getTables, and JMS template save and
  delete
- viewChannels: JMS getTemplates and getTemplate
- viewServerSettings: getProperty
- editServerSettings: setUpdateSettings

JMS deleteTemplate was declared with the operation name saveTemplate,
and its API summary described a save.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Finnegan's Owner <44065187+pacmano1@users.noreply.github.com>
MirthOperationPermissionTest walks every @MirthOperation in the core
API, connector and bundled plugin servlet interfaces and fails when one
declares no permission and is not on the test's list of operations that
need none, each listed with its reason. It also fails on a list entry
that matches no operation without a permission or more than one
overloaded method, and when the scan finds too few operations to mean
anything.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Finnegan's Owner <44065187+pacmano1@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Test Results

  145 files  +1    145 suites  +1   3m 15s ⏱️ -37s
  968 tests +4    968 ✅ +4  0 💤 ±0  0 ❌ ±0 
1 250 runs  +4  1 244 ✅ +4  6 💤 ±0  0 ❌ ±0 

Results for commit c4ec1c2. ± Comparison against base commit 89f1c03.

@mgaffigan mgaffigan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the scanner for future operations.

pacmano1 added a commit to diridium-com/role-based-access-control that referenced this pull request Nov 19, 2026
…es (#63)

rbac takes each core operation's permission from the engine through
OperationUtil, which only looks at the core API package. An extension's
servlet operations, the built-in connectors' test and lookup calls among them,
arrive as "<PLUGIN_POINT>#<operation>", so a permission the engine declares on
them never reached rbac. Plugins can register permissions through
getExtensionPermissions, but that path is for permissions a plugin defines,
and no connector uses it.

RegisteredOperationLabels reads the servlet interfaces each enabled extension
registers with the engine (apiProvider entries of type SERVLET_INTERFACE, the
list the engine's web server serves) when the controller is built: each
interface's PLUGIN_POINT and each @MirthOperation permission, keyed
PLUGIN_POINT#operation. rbac keeps no list of operations of its own. The
controller looks up a registered extension permission first, then a label,
then the core map. A label is enforced only when a role can be granted its
permission (core, or registered by an extension); otherwise the operation
stays as before, allowed with a warning.

On OIE 4.7.0 its connector operations declare no permission, and its eleven
labels, on the bundled plugins, repeat what those plugins already register.
A plugin that labels an operation without registering it now has that label
enforced where rbac used to allow the call. Diridium's plugins and the store
plugins checked (Web Support, Community Store, JavaScript Debugger, TLS
Manager, Message Inspector, Claude Assistant, Email Reader) are not affected:
each has no PLUGIN_POINT, labels nothing, or registers every labelled
operation with the same permission. On an engine that declares permissions on
its connector operations (OpenIntegrationEngine/engine#588), rbac enforces
them with no further change.

Also: README "What RBAC enforces" (its getTables example was a connector
operation the old lookup never covered), CLAUDE.md, a design-notes entry for
the choices that look odd in the code, and the two comments on the
Administrator settings tab, which said the preference calls are limited to the
user's own id on the server. Measured on 4.7.0, the engine asks the
authorization controller about a user's own preferences too, so the tab relies
on those calls declaring no permission. The e2e suite gains
labelled_operations, which passes on an engine with or without these labels
and fails on a mix.

Co-Authored-By: Claude <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.

2 participants