gnodet-bot commented on code in PR #14179:
URL: https://github.com/apache/maven/pull/14179#discussion_r4750507897


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/standalone/ApiRunner.java:
##########
@@ -673,6 +673,9 @@ private static AuthenticationSelector 
authenticationSelector(
             AuthenticationBuilder authBuilder = new AuthenticationBuilder();
             
authBuilder.addUsername(server.getUsername()).addPassword(server.getPassword());
             authBuilder.addPrivateKey(server.getPrivateKey(), 
server.getPassphrase());
+            authBuilder.addBearerToken(server.getToken());
+            server.getTokenHeaders()
+                    .forEach(tokenHeader -> 
authBuilder.addTokenHeader(tokenHeader.getName(), tokenHeader.getValue()));

Review Comment:
   ⚠️ **Missing validation:** 
`DefaultRepositorySystemSessionFactory.addTokens()` validates the bearer token 
value via `HttpTransporterUtils.isValidTokenValue()` and each header name via 
`isValidTokenHeaderName()` before wiring. This path skips both checks. Consider 
replacing these three lines with the shared static method:
   ```suggestion
               DefaultRepositorySystemSessionFactory.addTokens(authBuilder, 
server);
   ```



-- 
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]

Reply via email to