This issue has been created
There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-7f5009c9-a2ee-4346-87b7-914922580983 XWIKI-25219 Open

BaseObject#set throws a NullPointerException when setting an existing password property to the form placeholder

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-664ddb47-c891-4738-b9c5-a67198aad570 Simon Urli created this issue on 08/Oct/26 16:15
 
Summary: BaseObject#set throws a NullPointerException when setting an existing password property to the form placeholder
Issue Type: cid:jira-generated-image-avatar-7f5009c9-a2ee-4346-87b7-914922580983 Bug
Affects Versions: 17.9.0-rc-1
Assignee: Unassigned
Components: Old Core
Created: 08/Oct/26 16:15
Priority: cid:jira-generated-image-static-major-e1e4a649-04da-4e36-91d3-65452d0881f5 Major
Reporter: Simon Urli
Description:

Steps to reproduce

  • Have an XClass with a Password property, and an object of that class where the password is already set
  • Call $obj.set('password', '********') (e.g. the placeholder value sent back by a form displaying the password field in edit mode)

Expected

The existing password value is kept, as it was before 17.9.0RC1.

Actual

java.lang.NullPointerException: Cannot invoke "com.xpn.xwiki.objects.BaseProperty.getValue()" because "newProp" is null
 at com.xpn.xwiki.objects.BaseObject.set(BaseObject.java:522)
 at com.xpn.xwiki.api.Object.set(Object.java:206)

Analysis

PasswordClass#fromString deliberately returns null when given the form password placeholder, so that the stored password is not replaced by it. Before XWIKI-21417, BaseObject#set assigned the result of fromString to the property and skipped it when null, so the existing value was kept. Since XWIKI-21417, BaseObject#set updates the existing property in place with prop.setValue(newProp.getValue()), without checking whether newProp is null.

The null returned by fromString should be handled as "keep the current value".

This breaks for example the JIRA Macro basic auth configuration as soon as a second entry is saved: JIRA-126.

 
 

4 updates

 
cid:jira-generated-image-avatar-664ddb47-c891-4738-b9c5-a67198aad570 Changes by Simon Urli on 08/Oct/26 16:16
 
Fix Version: 18.9.0-rc-1
Fix Version: 17.10.14
Fix Version: 18.4.7
Assignee: Simon Urli