-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security] netrc support passes original credentials on HTTP redirects #9327
Comments
cc @genrym |
cc @aehlig |
cc @laurentlb this looks like a release blocker for 0.29 /cc #9293 |
Do we know what Bazel commit caused this to stop? Does it work with 0.28.1? |
@keith the PR referenced there is not the final implementation, and it was scrapped. The final implementation is pretty different. Just to clarify, the same configuration works well with bazel |
I think c26e339 was released only in 0.29 (it has only the 0.29 tag on GitHub; the baseline of 0.28 was from July 1st, so a few days before). |
Is the solution to roll back c26e339, then? |
The rollback might not be that easy... Can we investigate an actual fix? |
I am afraid I don't understand the error. What is wrong with the "Authorization" header that Bazel is generating in the curl command? |
I can reproduce the problem with 0.29.0 (with Bazel not with curl). I assume some versions of curl remove duplicate |
(meaning one header comes from .netrc and another provided on the command line) |
Oh, is curl also reading .netrc? I was not clear why there are two Authentication headers |
I can confirm this isn't a problem with 0.28.1 for me. If curl is reading the netrc that's happening with the default macOS curl:
|
Gerrit users started to report build breakage already, so that we urgently need a fix here. Unfortunately we bumped |
This reverts commit c26e339. Work on bazelbuild#9327.
This would definitely fix the issue, to actually fix this @artem-zinnatullin brought up that the issue is probably bazel passing authorization headers through to redirects, which is also likely a security problem, but some services might be depending on this. |
@katre Thanks for reverting the offending commit. I am able to reproduce the problem on Gerrit repository, stable-3.0 branch:
My Bazel version is:
|
We've spent more time with @keith looking at it, it seems that Bazel passes Auth headers along when server issues 3xx redirects even if target host changes (!) and that's why download from GitHub fails — it redirects to AWS S3 with AWS auth headers but Bazel also adds GitHub basic auth header on top and then S3 bails out because multiple auth methods are passed. This sounds like a pretty scary security vulnerability and reverting |
I'm just the release manager: if there are security implications then @dslomov needs to weigh in. |
My 2 cents:
|
That sounds like a reasonable plan. |
Ouch, thanks for taking a look!
Reverting .netrc is not enough: the underlying API - I'll prepare a patch that makes |
Given this severe security vulnerability in Bazel 0.29: [1] we prefer to upgrade to 1.0.0rc2, even though it is a release candidate and not officially released Bazel version. This effectively forces users to either download this release candidate manually from this loation: [2], or use bazelisk if they are not already, since this RC version is not included in regular package managers yet. [1] bazelbuild/bazel#9327 [2] https://releases.bazel.build/1.0.0/rc2/index.html Change-Id: I7d4121a145450f0d8687b239db3afa14f2dc0785
…ders Fix the signature of HttpConnector.connect. As the connect method handles redirects, we cannot have a fixed set of headers, once we support authentication, as the authentication headers depend on the host and that might change in a redirect. This change fixes the header generation in the HttpDownloader, but does not yet re-add the usage of the auth parmeter in the Starlark-provided download functions. Related #9327 Change-Id: Id12aa6a9a790fac6133a4da64baff58f02d36ef4 PiperOrigin-RevId: 269300472
Now that the root cause of bazelbuild#9327 is fixed in e38d838. This reverts commit a0e3bb2.
This still happens to me with bazel 1.2.0. |
I had a cached version of http.bzl. I cleared the cache and it was solved. |
I just tried to build on a new machine, and ran into this issue again with 3.4.1. Possibly related #10998. |
Description of the problem / feature request:
When you have a
~/.netrc
file with these contents:Downloads of GitHub tarballs fail with this error:
If you copy the curl request of what bazel is doing, you can see why:
Removing the Authorization header from the request fixes this issue. Switching the
Basic
auth tobearer
ortoken
and providing that directly doesn't solve this issue.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
bazel build //... --repository_cache=
What operating system are you running Bazel on?
macOS
What's the output of
bazel info release
?release 0.29.0
Have you found anything relevant by searching the web?
#7978
The text was updated successfully, but these errors were encountered: