github-advanced-security[bot] commented on code in PR #1416:
URL: https://github.com/apache/syncope/pull/1416#discussion_r3374864521
##########
core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/UserSelfLogic.java:
##########
@@ -262,17 +267,29 @@
throw sce;
}
- String key = userDAO.findKey(username).
- orElseThrow(() -> new NotFoundException("User " + username));
+ Optional<String> key = userDAO.findKey(username);
+ if (key.isEmpty()) {
+ if (!securityProperties.getPasswordReset().isHideDetails()) {
+ throw new NotFoundException("User " + username);
+ }
+ LOG.warn("Ignoring password reset request for unknown user [{}] in
domain [{}]",
+ username, AuthContextUtils.getDomain());
+ return;
+ }
if (confParamOps.get(
AuthContextUtils.getDomain(),
StandardConfParams.PASSWORD_RESET_SECURITY_QUESTION, false, boolean.class)
- && (securityAnswer == null ||
!provisioningManager.checkSecurityAnswer(key, securityAnswer))) {
+ && (securityAnswer == null ||
!provisioningManager.checkSecurityAnswer(key.get(), securityAnswer))) {
- throw
SyncopeClientException.build(ClientExceptionType.InvalidSecurityAnswer);
+ if (!securityProperties.getPasswordReset().isHideDetails()) {
+ throw
SyncopeClientException.build(ClientExceptionType.InvalidSecurityAnswer);
+ }
+ LOG.warn("Ignoring password reset request for user [{}] in domain
[{}]: missing or invalid security answer",
+ username, AuthContextUtils.getDomain());
Review Comment:
## CodeQL / Log Injection
This log entry depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/syncope/security/code-scanning/2641)
##########
core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/UserSelfLogic.java:
##########
@@ -262,17 +267,29 @@
throw sce;
}
- String key = userDAO.findKey(username).
- orElseThrow(() -> new NotFoundException("User " + username));
+ Optional<String> key = userDAO.findKey(username);
+ if (key.isEmpty()) {
+ if (!securityProperties.getPasswordReset().isHideDetails()) {
+ throw new NotFoundException("User " + username);
+ }
+ LOG.warn("Ignoring password reset request for unknown user [{}] in
domain [{}]",
+ username, AuthContextUtils.getDomain());
Review Comment:
## CodeQL / Log Injection
This log entry depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/syncope/security/code-scanning/2640)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]