-
Notifications
You must be signed in to change notification settings - Fork 1.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
Set custom CA file path for yarn berry #5783
Conversation
Didn't seem to do the trick in staging 🤔 |
Starting from the following error:
I've managed to find a resolution for yarn >= 4.0.0-rc.18. Based on the error I found this corepack issue which led me to setting the Once that was set we started seeing:
This is because yarn does not respect Yarn > 4.0.0-rc.18 was then functional, however due to yarnpkg/berry#3684 earlier versions fail with |
5100b69
to
7986ff1
Compare
Thanks for figuring that out @pavera 🎉 So it seems that the issue is mainly that proxy auth credentials aren't supported by older versions of yarn berry, but proxy authentication in itself is supported (although via this slightly funky setup instead of just relying on Right now I think we have a couple of options:
As far as I'm concerned option 1 is not acceptable, but the other to options are both worth considering. Maybe I'm missing something? |
I've read over the linked issues, but I'm not entirely clear on the regression from YARN 1 behaviour where I presume proxy auth worked 🤔 I can see the recommendation of setting it via:
in yarnpkg/berry#3684 (comment) Is there no way we can set both the Yarn 1 & berry envvars and then use version detection to set the configuration, or will these config variables fight each other in a way I'm not seeing? |
@brrygrdn from my understanding, the issue is that before yarnpkg/berry#4243 the Since Yarn Berry repo's typically ship with either the version of yarn that they used checked in to the repo, or specify what specific version to use which will then by installed on-the-fly by corepack, we can't rely on simply installing that latest release-candidate, but will instead use whatever version of yarn that is used by the repo (which is good). |
Hmm, could we interrogate the version of Yarn in use and set the envvars accordingly? I'm assuming not since some are being set in the docker image and it might result in his having to wrap every yarn command in a bunch of environment manipulation 🤔 |
We can, and we do, but in currently released versions of yarn berry setting these env variables does not work when they contain basic auth, as yarn does not forward the basic auth credentials, so any request made to the proxy fails Edit: Let me try to clarify. Yarn classic (1) is working fine, no issues there, the new env variables also don't clash. Yarn Berry however, currently does not work at all when the proxy is also running. We can correctly set the configuration to tell yarn what proxy to use ( |
I wonder if we could monkey patch the auth fix with a plugin? |
I briefly looked into it, but it didn't seem like you're able to override that part of yarn? 🤔 |
991c90d
to
2cfec5d
Compare
I've confirmed that the current changes work for both yarn 3 and 4 when removing basic auth from the proxy, I think we can merge these changes and then discuss what to do about the proxy separately, but I think it should be safe to remove the basic auth because we already have 2 other layers of protection:
|
The cert is to allow clients to validate/trust https responses from the proxy but wouldn't actually block usage.
It'd be worth reviewing if the proxy ever listens on its internet facing network. If so, we should shut that off regardless of auth as that could be an issue when running the proxy locally for development. I agree, besides confirming the proxy only listens on the internal updater network I'm not seeing much risk in removing the proxy auth. |
1f00528
to
0a738d5
Compare
In order for yarn berry to pick up our custom CA file path, we can set an environment variable instead of a custom config file.
0a738d5
to
936a32f
Compare
In order for yarn berry to pick up our custom CA file path, we can set an environment variable instead of a custom config file.
See https://yarnpkg.com/configuration/yarnrc#caFilePath: