This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-ac81d9ba-be08-408f-81b5-2e322b4c4e53 XWIKI-25016 Open

Broken comment line and misleading example for the hashed superadmin password in xwiki.cfg

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-ae91f124-ed71-4b9d-9255-11835b68fab5 Simon Urli created this issue on 17/Sep/26 14:29
 
Summary: Broken comment line and misleading example for the hashed superadmin password in xwiki.cfg
Issue Type: cid:jira-generated-image-avatar-ac81d9ba-be08-408f-81b5-2e322b4c4e53 Bug
Affects Versions: 18.8.0-rc-1
Assignee: Unassigned
Components: Old Core
Created: 17/Sep/26 14:29
Priority: cid:jira-generated-image-static-major-a8360977-e3b9-4c8a-8e80-02132826e1af Major
Reporter: Simon Urli
Description:

Problem

XWIKI-22257 added support for a hashed value in the xwiki.superadminpassword property and documented it in the comment block shipped in xwiki.cfg. That comment block has two defects, both introduced by commit e5f6530c1ae.

1. A comment line lost its "#-#" prefix

In xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.cfg.vm (lines 305-307 at the time of writing), the sentence describing the new format is wrapped onto a second line that does not start with the comment marker:

#-# [Since 18.8.0RC1] Instead of plain text password, you can use a hashed password string using
the format {hashAlgorithm}hash where the hash algorithm is an algorithm supported by PasswordClass.
#-# e.g., generated using htpasswd -bnBC 10 "" yourpassword | tr -d ':\n'

XWikiConfig extends java.util.Properties (XWikiConfig.java:36) and loads the file with load (XWikiConfig.java:69), so that second line is not a comment. It is parsed as a property:

key   = the
value = format {hashAlgorithm}hash where the hash algorithm is an algorithm supported by PasswordClass.

Every shipped xwiki.cfg therefore declares a bogus property, and an administrator reading the file sees a broken comment.

2. The htpasswd example omits the required algorithm prefix

The example produces a bare bcrypt hash:

htpasswd -bnBC 10 "" yourpassword | tr -d ':\n'

A value is only treated as a hash when it starts with the algorithm key between braces (AbstractXWikiAuthService.java:55-58). A bare hash does not match that pattern, so it falls through to the plain text comparison (AbstractXWikiAuthService.java:115) and authentication silently fails. The line above does give the format, but the example should show the prefix the value needs.

Expected

  • Restore the "#-#" prefix on the wrapped line, so that no bogus property is declared.
  • Show the algorithm prefix in the example, for instance the resulting property line rather than the bare hash.

Note

Both defects are in code the unreleased 18.8.0-rc-1 introduces. Per the project convention this would normally be fixed by reopening XWIKI-22257; a separate issue was requested instead.