github-advanced-security[bot] commented on code in PR #19:
URL:
https://github.com/apache/sling-org-apache-sling-auth-oauth-client/pull/19#discussion_r2123799993
##########
src/main/java/org/apache/sling/auth/oauth_client/impl/OAuthEntryPointServlet.java:
##########
@@ -43,65 +44,68 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.nimbusds.oauth2.sdk.id.Identifier;
+import static
org.osgi.service.component.annotations.ReferencePolicyOption.GREEDY;
-@Component(service = { Servlet.class },
- property = { AuthConstants.AUTH_REQUIREMENTS +"=" +
OAuthEntryPointServlet.PATH }
-)
+@Component(
+ service = {Servlet.class},
+ property = {AuthConstants.AUTH_REQUIREMENTS + "=" +
OAuthEntryPointServlet.PATH})
@SlingServletPaths(OAuthEntryPointServlet.PATH)
public class OAuthEntryPointServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = 1L;
public static final String PATH = "/system/sling/oauth/entry-point"; //
NOSONAR
-
+
private final Logger logger = LoggerFactory.getLogger(getClass());
-
+
private final Map<String, ClientConnection> connections;
private final CryptoService cryptoService;
@Activate
- public OAuthEntryPointServlet(@Reference(policyOption = GREEDY)
List<ClientConnection> connections,
+ public OAuthEntryPointServlet(
+ @Reference(policyOption = GREEDY) List<ClientConnection>
connections,
@Reference CryptoService cryptoService) {
- this.connections = connections.stream()
- .collect(Collectors.toMap( ClientConnection::name,
Function.identity()));
+ this.connections =
connections.stream().collect(Collectors.toMap(ClientConnection::name,
Function.identity()));
this.cryptoService = cryptoService;
}
@Override
protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull
SlingHttpServletResponse response)
throws ServletException, IOException {
-
+
try {
String desiredConnectionName = request.getParameter("c");
- if ( desiredConnectionName == null ) {
+ if (desiredConnectionName == null) {
logger.debug("Missing mandatory request parameter 'c'");
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
ClientConnection connection =
connections.get(desiredConnectionName);
- if ( connection == null ) {
+ if (connection == null) {
if (logger.isDebugEnabled()) {
- logger.debug("Client requested unknown connection '{}';
known: '{}'", desiredConnectionName, connections.keySet());
+ logger.debug(
+ "Client requested unknown connection '{}'; known:
'{}'",
+ desiredConnectionName,
+ connections.keySet());
Review Comment:
## Logging should not be vulnerable to injection attacks
<!--SONAR_ISSUE_KEY:AZc19UvDBWM6RLZqhz_b-->Change this code to not log
user-controlled data. <p>See more on <a
href="https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-auth-oauth-client&issues=AZc19UvDBWM6RLZqhz_b&open=AZc19UvDBWM6RLZqhz_b&pullRequest=19">SonarQube
Cloud</a></p>
[Show more
details](https://github.com/apache/sling-org-apache-sling-auth-oauth-client/security/code-scanning/5)
--
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]