Skip to content

Harden web console and Jolokia access by default#2025

Merged
jbonofre merged 2 commits into
apache:mainfrom
jbonofre:jolokia-jetty-security-enforcement
May 22, 2026
Merged

Harden web console and Jolokia access by default#2025
jbonofre merged 2 commits into
apache:mainfrom
jbonofre:jolokia-jetty-security-enforcement

Conversation

@jbonofre

Copy link
Copy Markdown
Member

jetty.xml:

  • Add Referrer-Policy and Permissions-Policy response headers; provide commented-out Strict-Transport-Security for HTTPS deployments.
  • Wrap the existing HandlerCollection in an InetAccessHandler and restrict access to loopback (127.0.0.1, ::1) by default. Provide commented-out templates for RFC1918 includes and exclude rules.
  • Tie Server.start() to the loopback include beans via depends-on so the allow-list is fully populated before the server starts.
  • Add a commented-out ForwardedRequestCustomizer for reverse-proxy setups, with a warning about header spoofing when the proxy does not strip inbound X-Forwarded-* headers.

jolokia-access.xml:

  • Restrict Jolokia to HTTP POST to kill GET-based CSRF/SSRF vectors.
  • Deny destructive and privileged broker operations (terminateJVM, stop, restart, add/removeConnector, add/removeQueue/Topic, durable subscriber lifecycle, runtime limit setters, reloadLog4jProperties).
  • Deny destination message-data mutation (purge, remove/copy/move messages, sendTextMessage*, pause/resume); browse* remains allowed.
  • Deny durable subscriber destroy/setSelector and JobScheduler removeJob*.
  • Deny NetworkConnector Password/RemotePassword attributes and credential setters.
  • Deny known JMX RCE / introspection surfaces: javax.management.loading MLet, JMImplementation, java.util.logging, java.lang:type=Memory and ClassLoading, plus java.lang:type=Runtime SystemProperties and InputArguments.

jetty.xml:
- Add Referrer-Policy and Permissions-Policy response headers; provide
  commented-out Strict-Transport-Security for HTTPS deployments.
- Wrap the existing HandlerCollection in an InetAccessHandler and restrict
  access to loopback (127.0.0.1, ::1) by default. Provide commented-out
  templates for RFC1918 includes and exclude rules.
- Tie Server.start() to the loopback include beans via depends-on so the
  allow-list is fully populated before the server starts.
- Add a commented-out ForwardedRequestCustomizer for reverse-proxy setups,
  with a warning about header spoofing when the proxy does not strip
  inbound X-Forwarded-* headers.

jolokia-access.xml:
- Restrict Jolokia to HTTP POST to kill GET-based CSRF/SSRF vectors.
- Deny destructive and privileged broker operations (terminateJVM, stop,
  restart, add/removeConnector, add/removeQueue/Topic, durable subscriber
  lifecycle, runtime limit setters, reloadLog4jProperties).
- Deny destination message-data mutation (purge, remove/copy/move
  messages, sendTextMessage*, pause/resume); browse* remains allowed.
- Deny durable subscriber destroy/setSelector and JobScheduler removeJob*.
- Deny NetworkConnector Password/RemotePassword attributes and credential
  setters.
- Deny known JMX RCE / introspection surfaces: javax.management.loading
  MLet, JMImplementation, java.util.logging, java.lang:type=Memory and
  ClassLoading, plus java.lang:type=Runtime SystemProperties and
  InputArguments.
@jbonofre jbonofre requested review from cshannon and mattrpav May 19, 2026 15:22
Add a jolokiaSecurityConstraintMapping that binds adminSecurityConstraint
(admins-only) to /api/jolokia/*, mirroring how *.action is gated on the
web console. Wired into securityHandler before securityConstraintMapping
so the admin role check applies to all Jolokia requests rather than the
broader users/admins constraint.

@cshannon cshannon 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.

@jbonofre - nice job! I think this looks very good, we can keep hardening if needed but this is looking good to me for now

@mattrpav mattrpav 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.

LGTM

@jbonofre jbonofre merged commit 052369f into apache:main May 22, 2026
10 checks passed
jbonofre added a commit that referenced this pull request May 23, 2026
* Harden web console and Jolokia access by default

jetty.xml:
- Add Referrer-Policy and Permissions-Policy response headers; provide
  commented-out Strict-Transport-Security for HTTPS deployments.
- Wrap the existing HandlerCollection in an InetAccessHandler and restrict
  access to loopback (127.0.0.1, ::1) by default. Provide commented-out
  templates for RFC1918 includes and exclude rules.
- Tie Server.start() to the loopback include beans via depends-on so the
  allow-list is fully populated before the server starts.
- Add a commented-out ForwardedRequestCustomizer for reverse-proxy setups,
  with a warning about header spoofing when the proxy does not strip
  inbound X-Forwarded-* headers.

jolokia-access.xml:
- Restrict Jolokia to HTTP POST to kill GET-based CSRF/SSRF vectors.
- Deny destructive and privileged broker operations (terminateJVM, stop,
  restart, add/removeConnector, add/removeQueue/Topic, durable subscriber
  lifecycle, runtime limit setters, reloadLog4jProperties).
- Deny destination message-data mutation (purge, remove/copy/move
  messages, sendTextMessage*, pause/resume); browse* remains allowed.
- Deny durable subscriber destroy/setSelector and JobScheduler removeJob*.
- Deny NetworkConnector Password/RemotePassword attributes and credential
  setters.
- Deny known JMX RCE / introspection surfaces: javax.management.loading
  MLet, JMImplementation, java.util.logging, java.lang:type=Memory and
  ClassLoading, plus java.lang:type=Runtime SystemProperties and
  InputArguments.

* jetty.xml: restrict Jolokia endpoint to admins role

Add a jolokiaSecurityConstraintMapping that binds adminSecurityConstraint
(admins-only) to /api/jolokia/*, mirroring how *.action is gated on the
web console. Wired into securityHandler before securityConstraintMapping
so the admin role check applies to all Jolokia requests rather than the
broader users/admins constraint.
jbonofre added a commit that referenced this pull request May 23, 2026
)

* Harden web console and Jolokia access by default

jetty.xml:
- Add Referrer-Policy and Permissions-Policy response headers; provide
  commented-out Strict-Transport-Security for HTTPS deployments.
- Wrap the existing HandlerCollection in an InetAccessHandler and restrict
  access to loopback (127.0.0.1, ::1) by default. Provide commented-out
  templates for RFC1918 includes and exclude rules.
- Tie Server.start() to the loopback include beans via depends-on so the
  allow-list is fully populated before the server starts.
- Add a commented-out ForwardedRequestCustomizer for reverse-proxy setups,
  with a warning about header spoofing when the proxy does not strip
  inbound X-Forwarded-* headers.

jolokia-access.xml:
- Restrict Jolokia to HTTP POST to kill GET-based CSRF/SSRF vectors.
- Deny destructive and privileged broker operations (terminateJVM, stop,
  restart, add/removeConnector, add/removeQueue/Topic, durable subscriber
  lifecycle, runtime limit setters, reloadLog4jProperties).
- Deny destination message-data mutation (purge, remove/copy/move
  messages, sendTextMessage*, pause/resume); browse* remains allowed.
- Deny durable subscriber destroy/setSelector and JobScheduler removeJob*.
- Deny NetworkConnector Password/RemotePassword attributes and credential
  setters.
- Deny known JMX RCE / introspection surfaces: javax.management.loading
  MLet, JMImplementation, java.util.logging, java.lang:type=Memory and
  ClassLoading, plus java.lang:type=Runtime SystemProperties and
  InputArguments.

* jetty.xml: restrict Jolokia endpoint to admins role

Add a jolokiaSecurityConstraintMapping that binds adminSecurityConstraint
(admins-only) to /api/jolokia/*, mirroring how *.action is gated on the
web console. Wired into securityHandler before securityConstraintMapping
so the admin role check applies to all Jolokia requests rather than the
broader users/admins constraint.
epearson-tt pushed a commit to epearson-tt/activemq that referenced this pull request Jun 10, 2026
…ult (apache#2025) (apache#2037)

* Harden web console and Jolokia access by default

jetty.xml:
- Add Referrer-Policy and Permissions-Policy response headers; provide
  commented-out Strict-Transport-Security for HTTPS deployments.
- Wrap the existing HandlerCollection in an InetAccessHandler and restrict
  access to loopback (127.0.0.1, ::1) by default. Provide commented-out
  templates for RFC1918 includes and exclude rules.
- Tie Server.start() to the loopback include beans via depends-on so the
  allow-list is fully populated before the server starts.
- Add a commented-out ForwardedRequestCustomizer for reverse-proxy setups,
  with a warning about header spoofing when the proxy does not strip
  inbound X-Forwarded-* headers.

jolokia-access.xml:
- Restrict Jolokia to HTTP POST to kill GET-based CSRF/SSRF vectors.
- Deny destructive and privileged broker operations (terminateJVM, stop,
  restart, add/removeConnector, add/removeQueue/Topic, durable subscriber
  lifecycle, runtime limit setters, reloadLog4jProperties).
- Deny destination message-data mutation (purge, remove/copy/move
  messages, sendTextMessage*, pause/resume); browse* remains allowed.
- Deny durable subscriber destroy/setSelector and JobScheduler removeJob*.
- Deny NetworkConnector Password/RemotePassword attributes and credential
  setters.
- Deny known JMX RCE / introspection surfaces: javax.management.loading
  MLet, JMImplementation, java.util.logging, java.lang:type=Memory and
  ClassLoading, plus java.lang:type=Runtime SystemProperties and
  InputArguments.

* jetty.xml: restrict Jolokia endpoint to admins role

Add a jolokiaSecurityConstraintMapping that binds adminSecurityConstraint
(admins-only) to /api/jolokia/*, mirroring how *.action is gated on the
web console. Wired into securityHandler before securityConstraintMapping
so the admin role check applies to all Jolokia requests rather than the
broader users/admins constraint.

(cherry picked from commit be8415f)
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.

3 participants