cstamas commented on PR #14203:
URL: https://github.com/apache/maven/pull/14203#issuecomment-7308112160

   @rmannibucau I'm afraid it does.
   
   `isValidTokenHeaderName` doesn't decide whether a header is sensitive. It 
only checks that the name is a valid RFC 9110 token and isn't a header the HTTP 
clients or the connection manage themselves (Host, Content-Length, 
Proxy-Authorization, Sec-*, ...). Workstation, X-Build-Id, X-Request-Source and 
so on all pass. So every ordinary `httpHeaders` entry becomes a token header, 
i.e. **authentication**, and nothing is "routed" between sensitive and 
non-sensitive.
   
   Here is what that means in Resolver 2.0.27:
   
   1. Token headers replace configured headers with the same name 
(HttpTransporterUtils#putTokenHeaders). The entry is still in HTTP_HEADERS, but 
what the transport sends is the token header.
   2. Token headers are **always origin-scoped** as every secret, and ignore 
`aether.transport.http.originScopedHeaders`. All four HTTP transports (Apache, 
JDK, Jetty, URL) do this, and the shared HttpTransporterTest checks it with 
scoping both on and off. This is on purpose: auth material must never leave the 
origin.
   3. Token values are validated strictly. They must not be blank and may 
contain only visible ASCII, spaces and tabs. A value that fails this (empty, or 
non-ASCII like Workstation: Tücö) now makes transporter creation fail with 
"Missing or invalid HTTP token value", which breaks the build for a header that 
has nothing to do with auth.
   
   Take my example again: a user wants token auth to the repository, and 
`Workstation: Tuco` on every HTTP request the workstation makes, including 
redirect hops to a CDN or another host. Resolver supports this today, because 
auth and headers are controlled separately:
   
   - authentication (username/password, and now token headers via 
AuthenticationBuilder#addTokenHeader/addBearerToken) always stays on the 
repository origin;
   - configured headers (aether.transport.http.headers) follow 
`aether.transport.http.originScopedHeaders`, which is `true` by default since 
2.0.25. The user sets it to `false` to have them sent everywhere.
   
   With this PR, Maven feeds both from the same `<httpHeaders>` element, so 
that user can't have both anymore. `Workstation: Tuco` **silently becomes 
origin-only auth material**, and `originScopedHeaders=false` no longer has any 
effect on it. That's the either/or I meant, and it breaks the original (Maven 
2) purpose of `<httpHeaders>`: customizing HTTP headers.
   


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