0

The code below shows that I am trying to get the "encodedpassword" attribute value from the User type's JsonAuditRecord using the ReadAuditGateway.

JsonAuditRecord userJsonRecord = getUserJsonAuditRecords_withReadAuditGateway(query);
String encodedPassword = userJsonRecord.getAttributeAfterOperation("encodedpassword");

System.out.println(encodedPassword); //Hybris1808 would print the actual encoded password
System.out.println(encodedPassword); //CX2011 prints **** instead

After upgrading to CX2011, I found out that the User type's encodedPassword is audit blacklisted. Also, any blacklisted attributes would have their value obscured e.g. ****. I understand the rational behind that (possibly a security enhancement). However, to allow our custom code (that requires the un-obscured value of the encodedPassword) to continue working, I have tried to remove it from the audit blacklist by making sure that the two properties below are not set with any value in my local.properties

audit.user.blacklistedProperties=
audit.userpasswordchangeaudit.blacklistedProperties=

However, after performing "ant all" and restarted my local Hybris server, the encodedPassword is still obscured..

May I ask other than changing those properties above, are there other steps that needs to be done? e.g. overriding some OOTB classes.

Also, I have tried to read the Audit Report section in the SAP Commerce Documentation, I do not see the audit blacklisting part is being documented. I would appreciate if someone could also provide any links that relates to this topic.

4

1 回答 1

1
audit.user.blacklistedProperties=encodedpassword
audit.userpasswordchangeaudit.blacklistedProperties=encodedpassword

上面的这两个属性已经在 project.properties 文件之一中定义,如上所示(其中“encodedpassword”被列入黑名单)。因此,如果我们在 local.properties 文件中将这两个留空,Hybris 会将其视为 NULL 并忽略/跳过它。换句话说,它不会通过声明空属性来做任何事情。

要纠正这一点,最简单的方法是在 local.properties 文件中将一些其他字段指定为列入黑名单的属性。

例如

audit.user.blacklistedProperties=fooAttribute
audit.userpasswordchangeaudit.blacklistedProperties=fooAttribute
于 2021-11-26T13:34:43.230 回答