-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: permit marking a module as private in go.mod #33985
Comments
Definitely agree. Telling everybody at your company to "set the GOPRIVATE=..." seems impractical, and having this information lying in the That would make it possible to pull a repo from a git server and built it, without configuring you environment. Although I wonder how to solve the syntax-problem.
Feels clunky (and embedding machine-information in comments is not a nice solution imho) |
It feels like we got rid of GOPATH only to replace it by a convoluted series of new GOPATHs (i.e. GOPRIVATE, GOPROXY, GONOPROXY, GOSUMDB). |
(I could've sworn I'd seen this issue before, but I can't find a duplicate right now...) |
The major problem with indicating private repos in the For example: if your company is running its own (authenticated) corp module proxy, then it is entirely reasonable for the So “private” is fundamentally relative to the proxy, not relative to the module dependency. |
I remember the issue very well, but I can't seem to find it either :/ However, I do sympathize with the issue here, because you can't force all of your team members to set up the correct configuration and environment variables on their machines. And since "private" is relative to the proxy, maybe it's worth considering adding the GOPROXY variable to the go.mod file itself (as well as the GONOSUMDB and friends) Or maybe, just be able to set any of the This way, you don't need to set a "private directive" in the go.mod file, but still resolve the issue mentioned above. That said, one can simply have a |
I think it was discussed as part of the larger #25530 discussion, such as in #25530 (comment) and some related comments there, as well as some of that discussion I think then triggered some additions to the proposal document, such as:
I don't recall a specific issue aside from #25530. |
That is true. For example, at a company with ~50 people, we have our own (private) Gitlab instance running. However, we are only ~5 devs actually using Go. Normally, public projects will not depend on private repos. That said, setting |
@tommyknows: I think it's expected that some organizations will want to, but certainly not everybody. However, keep in mind that (as touched on in #25530 (comment)) the |
@tommyknows, if you configure a proxy in your Moreover: suppose that I have five developers but fifty repos: now adding the environment variable is actually less work overall than annotating all of the At the other extreme, suppose that I have fifty developers and only one repo: now I don't need to annotate dependencies at all, because there's only one module containing private things and it doesn't depend on any other private dependencies. The cost/benefit tradeoff you're describing is only favorable to the |
You are right, definitely agree with that point. What I don't like is that one needs to set an environment variable to not expose "private" information. imho, the "default" value of |
A goal could be to use information in
I think the real goal would be to avoid accidentally interacting with public proxies and the public sum.golang.org. The most important public proxy to help people accidentally hit after a mistake would be the public proxy that is used in the absence of any configuration -- proxy.golang.org. In other words, one class of mistake is forgetting to make any configuration, and in that case, the public infrastructure would be in use (and not any private proxy, given using a private proxy requires some configuration). So maybe that could simplify the problem some?
Adding the GOPROXY variable (or equivalent content) to You could imagine a
(with a deliberately bad name chosen to emphasize I am not suggesting an actual syntax or actual name). That could help some mistakes, for example if someone does a However, it's not immediately obvious how
You could make a non-default / user-specified privacy pattern a requirement for every go.mod before cmd/go will do anything else, but (a) that might not be popular, and (b) that still doesn't mean people would set it properly. In summary, I am not sure a bullet proof |
Continuing on the "things that might not be popular" brainstorming tack: A heavier-handed approach could be refuse to access the network until the user has taken some specific step regarding privacy settings (either in the current environmental settings, or based on go.mod). For example, if you are starting a new module (and hence no go.mod-based privacy settings) and have no privacy settings in your user's environment, it could be an error to try to access the network, with some message along the lines of:
Or maybe it does not key off of privacy patterns... but the general comment is that it could force the user to take some action to eliminate the "whoops, I forgot to configure anything" type of error. |
I like the idea of disabling default proxy value by a flag in go.mod, so that proxy can only be used if explicitly set with env var. Or as a more flexible/complicated solution we can have tags on dependencies and only resolve such with appropriate proxies.
|
Coldn't agree more with this point. IMHO the defaults shouldn't be "expose info to a 3rd company/public proxy" event if that info isn't too much but import paths. In my opinion someone that knows what is doing would easily set an ENV in order to get the benefits of the public proxy. On the contrary, someone that just clones the project and doesn't know about the proxies or is just using a new computer and forgot to set the envs would automatically leak info. Not sure about the solution, I agree with @thepudds & @bcmills in the point that the A couple of ideas I can think of: A. |
Am I correct to assume this won’t be fixed until 1.14? I’m not sure I like the idea of having to skip 1.13 to avoid simple user error leaking information. (Also, Can someone please remember to update the app engine docs for cloud build and regular app engine deploys to avoid leaking private repos.) |
@zaddok, Go 1.13 has been released, and this issue was filed well after the freeze window. The proposed changes will not happen in 1.13, but don't assume they will necessarily happen in 1.14 either. |
Just one |
The problem is that every developer with access to the code that has private dependencies needs to do this. If anyone forgets, the build will break on their machine. I'm personally also concerned that private module names will be sent to public infrastructure. |
I'd also argue for those of us who have private repo's on GitHub marking the entire github domain as private isn't a great solution. |
You can mark only your GitHub name or repo explicitly. Like Details here: https://golang.org/cmd/go/#hdr-Module_configuration_for_non_public_modules. Pay attention to:
|
In that case, maybe this a need for having something like |
There could be a new
Like the |
sounds like we won't do this. |
The new proxy system requires individual machines environmental variables to be set up for private modules. This means knowledge about the build that is not kept in the repo. This is not ideal.
I believe a good feature would be the ability to mark a module as private in the go.mod rather than depending on each machine setting it's environmental variables correctly.
Originally posted by @donatj in #33980 (comment)
The text was updated successfully, but these errors were encountered: