Skip to content

fixes #244: Prevent REST API plugin from exposing its own configuration - #245

Open
guusdk wants to merge 9 commits into
igniterealtime:mainfrom
guusdk:244_do-not-expose-own-config
Open

fixes #244: Prevent REST API plugin from exposing its own configuration#245
guusdk wants to merge 9 commits into
igniterealtime:mainfrom
guusdk:244_do-not-expose-own-config

Conversation

@guusdk

@guusdk guusdk commented Sep 8, 2026

Copy link
Copy Markdown
Member

The REST API plugin's system properties endpoints (GET/POST/PUT/DELETE /plugins/restapi/v1/system/properties) allowed
reading and writing any Openfire system property, including the properties that control the REST API plugin's own behavior This allowed a caller with REST API access to durably reconfigure the plugin's own authentication, amongst others

This PR:

  • Migrates the plugin's remaining raw JiveGlobals-backed settings to Openfire's typed SystemProperty API with plugin="REST API"
  • Add SystemController.getForbiddenPropertyKeys(), which derives the set of properties owned by this plugin from SystemPropert metadata rather than an explicit key list, so any current or future plugin.restapi.* property is covered automatically.
  • Enforce this block consistently across all property operations, returning 403 rather than exposing or accepting changes to these keys.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are a few concrete correctness/quality issues in the updated code and UI (notably misleading 403 error messaging and minor cleanup) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR addresses issue #244 by preventing the REST API plugin’s /system/properties endpoints from exposing or allowing modification of system properties that configure the REST API plugin itself (notably authentication-related settings). It does so by migrating plugin settings to Openfire’s typed SystemProperty API (scoped to plugin "REST API") and by filtering/forbidding access to all properties owned by that plugin.

Changes:

  • Migrates REST API plugin configuration (enabled/auth type/secret/allowed IPs/custom auth filter/logging) from raw JiveGlobals access to typed SystemProperty definitions.
  • Adds enforcement in SystemController to filter plugin-owned properties from listings and reject GET/PUT/POST/DELETE on those keys with HTTP 403.
  • Updates admin UI usage, OpenAPI annotations, i18n property descriptions, and adds Hurl e2e coverage for forbidden keys.
File summaries
File Description
test/system.hurl Adds e2e assertions that plugin-owned system property keys return 403 for GET/PUT/DELETE.
src/web/rest-api.jsp Updates admin UI to use typed SystemProperty values and enum-based auth type handling.
src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java Switches legacy user service checks to typed SystemProperty reads.
src/java/org/jivesoftware/openfire/plugin/rest/service/SystemService.java Documents 403 responses for prohibited system property create/update/delete operations.
src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java Uses typed SystemProperty reads to decide whether to load the custom auth filter.
src/java/org/jivesoftware/openfire/plugin/rest/service/CustomOpenApiResource.java Updates OpenAPI security scheme selection to use typed auth type.
src/java/org/jivesoftware/openfire/plugin/rest/RESTServicePlugin.java Introduces typed SystemProperty definitions for plugin configuration and removes PropertyEventListener-based state.
src/java/org/jivesoftware/openfire/plugin/rest/controller/UserServiceController.java Switches service logging toggle to typed SystemProperty.
src/java/org/jivesoftware/openfire/plugin/rest/controller/SystemController.java Filters out plugin-owned properties and forbids access/modification (403) via REST endpoints.
src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCServiceController.java Switches service logging toggle to typed SystemProperty.
src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java Switches service logging toggle to typed SystemProperty.
src/java/org/jivesoftware/openfire/plugin/rest/controller/ClusteringController.java Switches service logging toggle to typed SystemProperty.
src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java Switches enabled/auth-type/secret/allowed-IPs checks to typed SystemProperty.
src/i18n/restapi_i18n.properties Adds system_property.* descriptions for newly-typed REST API plugin properties.
src/i18n/restapi_i18n_nl.properties Adds Dutch translations for the new system_property.* descriptions.
plugin.xml Adds <priorToServerVersion> metadata to constrain compatibility.
changelog.html Adds a changelog entry for #244.
Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread changelog.html Outdated
Comment thread src/java/org/jivesoftware/openfire/plugin/rest/controller/SystemController.java Outdated
Comment thread src/java/org/jivesoftware/openfire/plugin/rest/controller/SystemController.java Outdated
Comment thread src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java Outdated
Comment thread src/web/rest-api.jsp Outdated
…wn configuration

The REST API plugin's system properties endpoints (GET/POST/PUT/DELETE /plugins/restapi/v1/system/properties) allowed reading and writing any Openfire system property, including the properties that control the REST API plugin's own behavior.

This allowed a caller with REST API access to durably reconfigure the plugin's own authentication, amongst others.
@guusdk
guusdk force-pushed the 244_do-not-expose-own-config branch from 351ad1b to 952e736 Compare September 9, 2026 14:31
@guusdk
guusdk requested a lite review from Copilot September 9, 2026 14:31
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a738eab8-d7ba-42c0-a832-a99d056aabd8

📥 Commits

Reviewing files that changed from the base of the PR and between fe5f074 and 952e736.

📒 Files selected for processing (17)
  • changelog.html
  • plugin.xml
  • src/i18n/restapi_i18n.properties
  • src/i18n/restapi_i18n_nl.properties
  • src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java
  • src/java/org/jivesoftware/openfire/plugin/rest/RESTServicePlugin.java
  • src/java/org/jivesoftware/openfire/plugin/rest/controller/ClusteringController.java
  • src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java
  • src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCServiceController.java
  • src/java/org/jivesoftware/openfire/plugin/rest/controller/SystemController.java
  • src/java/org/jivesoftware/openfire/plugin/rest/controller/UserServiceController.java
  • src/java/org/jivesoftware/openfire/plugin/rest/service/CustomOpenApiResource.java
  • src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java
  • src/java/org/jivesoftware/openfire/plugin/rest/service/SystemService.java
  • src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java
  • src/web/rest-api.jsp
  • test/system.hurl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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