Refactor git ssh url parsing#4142
Conversation
e4df209 to
6c78917
Compare
6c78917 to
1410754
Compare
00a04cb to
1eec8a9
Compare
This was done in order to construct a consistent ID (that's passed to
This reason was ever-so-briefly described in the old code's comment: There might additionally be a security concern now that remote contains a username/password (or in the case of github, they actually allow a token to be passed as the username) -- credentials shouldn't be stored in the cache ID. |
This should be ok I think - the cache key for git sources is computed from the git sha (see #2091) buildkit/source/git/gitsource.go Line 299 in 67e1e6d The identifier itself isn't used to compute the cache, so it should never end up in the cache id, it's only ever recorded in the op. Even then, we wouldn't be able to execute two different urls concurrently, since the vertex digests used for this are a checksum of the entire source definition (which will include the full URL). I think we can keep the consistent ID, but I'm fairly sure that it won't actually change the caching/concurrent execution behavior. |
1eec8a9 to
390b183
Compare
84b510f to
38b8565
Compare
8b56a4b to
a8d926a
Compare
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
This should also resolve the ports parsing issue. Co-authored-by: Aaron Lehmann <alehmann@netflix.com> Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
This is an alternative to the solution proposed in #4069, see #4069 (comment) (cc @aaronlehmann)
Wherever possible, we should parse SSH urls using
url.Parse. See the updated tests for the exact changes in behavior:username@host:org/repo) intossh://URLs.