rmannibucau commented on code in PR #14203:
URL: https://github.com/apache/maven/pull/14203#discussion_r4751251494


##########
maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java:
##########
@@ -418,9 +418,19 @@ public RepositorySystemSession.SessionBuilder 
newRepositorySessionBuilder(MavenE
                     if (properties != null && properties.length > 0) {
                         headers = new HashMap<>();
                         for (PlexusConfiguration property : properties) {
-                            headers.put(
-                                    property.getChild("name").getValue(),
-                                    property.getChild("value").getValue());
+                            String name = property.getChild("name").getValue();
+                            String value = 
property.getChild("value").getValue();
+                            headers.put(name, value);
+                            // Wire token headers into Authentication so the 
resolver enforces
+                            // origin-scoping, preemptive sending, and RFC 
9110 validation.
+                            // Values were already decrypted by 
DefaultSettingsDecrypter.
+                            if (name != null && value != null && 
HttpTransporterUtils.isValidTokenHeaderName(name)) {
+                                if ("Authorization".equalsIgnoreCase(name) && 
value.startsWith("Bearer ")) {

Review Comment:
   we need a configurable list of these (i'd say just header name) since there 
are a lot of patterns and not all are bearer so maybe something like:
   
   ```
   Authorization
   PRIVATE-TOKEN
   JOB-TOKEN
   Circle-Token
   X-Buildkite-Token
   X-Gitlab-Token
   X-API-Key
   API-Key
   apikey
   api_key
   X-API-Token
   Ocp-Apim-Subscription-Key
   X-Goog-Api-Key
   X-Auth-Token
   X-AUTH-TOKEN
   X-Auth-Key
   X-Access-Token
   X-Forwarded-Access-Token
   X-Token
   Access-Token
   Private-Token
   Client-Token
   Client-Secret
   X-Client-Secret
   X-Client-Key
   DPoP
   X-Jenkins-Crumb
   X-Original-Authorization
   ```



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