Skip to content

Commit dca6af3

Browse files
committed
OF-2893: Warn administrator when a wildcard pattern is loaded (but wildcards are disabled)
1 parent 2950d05 commit dca6af3

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

i18n/src/main/resources/openfire_i18n.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2832,6 +2832,7 @@ plugin.admin.failed.minJavaVersion=The plugin requires Java specification versio
28322832
plugin.admin.failed.missingParent=The plugin requires another plugin, named {0}, that currently is not installed.
28332833
plugin.admin.failed.databaseScript=A plugin database install or update script failed. Review the logs for additional details.
28342834
plugin.admin.failed.unknown=An exception occurred while loading plugin. Review the logs for additional details.
2835+
plugin.admin.wildcards-exists=A plugin has loaded admin console authentication bypass patterns that includes a wildcard, but the System Property 'adminConsole.access.allow-wildcards-in-excludes' is disabled.
28352836

28362837
# System Admin Console access
28372838
system.admin.console.access.title=Admin Console Access

xmppserver/src/main/java/org/jivesoftware/admin/AuthCheckFilter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ public static void removeExclude(String exclude) {
174174
excludes.remove(exclude);
175175
}
176176

177+
/**
178+
* Indicates to the caller whether any of the currently loaded exclusions contains a wildcard
179+
*/
180+
public static boolean excludesIncludeWildcards() {
181+
return excludes.stream().anyMatch(e -> e.contains("*"));
182+
}
183+
177184
/**
178185
* Returns true if a URL passes an exclude rule.
179186
*

xmppserver/src/main/webapp/plugin-admin.jsp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
org.apache.commons.fileupload.disk.DiskFileItemFactory,
2424
org.apache.commons.fileupload.servlet.ServletFileUpload"
2525
%>
26+
<%@ page import="org.jivesoftware.admin.AuthCheckFilter" %>
2627
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
2728
<%@ page import="org.jivesoftware.openfire.container.PluginManager" %>
2829
<%@ page import="org.jivesoftware.openfire.update.UpdateManager" %>
@@ -369,6 +370,11 @@ tr.lowerhalf > td:last-child {
369370
<fmt:message key="plugin.admin.monitortask_running" />
370371
</admin:infobox>
371372
</c:if>
373+
<c:if test="${ AuthCheckFilter.excludesIncludeWildcards() && !AuthCheckFilter.ALLOW_WILDCARDS_IN_EXCLUDES.getValue() }">
374+
<admin:infobox type="warning">
375+
<fmt:message key="plugin.admin.wildcards-exists" />
376+
</admin:infobox>
377+
</c:if>
372378
<p>
373379
<fmt:message key="plugin.admin.info"/>
374380
</p>

0 commit comments

Comments
 (0)