@@ -74,12 +74,13 @@ RUN echo "ok" > /foo
7474 builder .DefaultLocalNameContext : dir ,
7575 },
7676 FrontendAttrs : map [string ]string {
77- "attest:provenance" : provReq ,
78- "build-arg:FOO" : "bar" ,
79- "label:lbl" : "abc" ,
80- "vcs:source" : "https://example.invalid/repo.git" ,
81- "vcs:revision" : "123456" ,
82- "filename" : "Dockerfile" ,
77+ "attest:provenance" : provReq ,
78+ "build-arg:FOO" : "bar" ,
79+ "label:lbl" : "abc" ,
80+ "vcs:source" :
"https://user:[email protected] /repo.git" ,
81+ "vcs:revision" : "123456" ,
82+ "filename" : "Dockerfile" ,
83+ builder .
DefaultLocalNameContext + ":foo" :
"https://foo:[email protected] /foo.html" ,
8384 },
8485 Exports : []client.ExportEntry {
8586 {
@@ -137,30 +138,32 @@ RUN echo "ok" > /foo
137138 require .Equal (t , "gateway.v0" , pred .Invocation .Parameters .Frontend )
138139
139140 if mode == "max" || mode == "" {
140- require .Equal (t , 3 , len (args ), "%v" , args )
141+ require .Equal (t , 4 , len (args ), "%v" , args )
141142 require .True (t , pred .Metadata .Completeness .Parameters )
142143
143144 require .Equal (t , "bar" , args ["build-arg:FOO" ])
144145 require .Equal (t , "abc" , args ["label:lbl" ])
145146 require .Contains (t , args ["source" ], "buildkit_test/" )
146147 } else {
147148 require .False (t , pred .Metadata .Completeness .Parameters )
148- require .Equal (t , 1 , len (args ), "%v" , args )
149+ require .Equal (t , 2 , len (args ), "%v" , args )
149150 require .Contains (t , args ["source" ], "buildkit_test/" )
150151 }
152+ require .
Equal (
t ,
"https://xxxxx:[email protected] /foo.html" ,
args [
"context:foo" ])
151153 } else {
152154 require .Equal (t , "dockerfile.v0" , pred .Invocation .Parameters .Frontend )
153155
154156 if mode == "max" || mode == "" {
155- require .Equal (t , 2 , len (args ))
157+ require .Equal (t , 3 , len (args ))
156158 require .True (t , pred .Metadata .Completeness .Parameters )
157159
158160 require .Equal (t , "bar" , args ["build-arg:FOO" ])
159161 require .Equal (t , "abc" , args ["label:lbl" ])
160162 } else {
161163 require .False (t , pred .Metadata .Completeness .Parameters )
162- require .Equal (t , 0 , len (args ), "%v" , args )
164+ require .Equal (t , 1 , len (args ), "%v" , args )
163165 }
166+ require .
Equal (
t ,
"https://xxxxx:[email protected] /foo.html" ,
args [
"context:foo" ])
164167 }
165168
166169 expectedBase := "pkg:docker/busybox@latest?platform=" + url .PathEscape (platforms .Format (platforms .Normalize (platforms .DefaultSpec ())))
@@ -177,7 +180,7 @@ RUN echo "ok" > /foo
177180
178181 if ! isClient {
179182 require .Equal (t , "Dockerfile" , pred .Invocation .ConfigSource .EntryPoint )
180- require .Equal (t , "https://example.invalid/repo.git" , pred .Metadata .BuildKitMetadata .VCS ["source" ])
183+ require .Equal (t , "https://xxxxx:xxxxx@ example.invalid/repo.git" , pred .Metadata .BuildKitMetadata .VCS ["source" ])
181184 require .Equal (t , "123456" , pred .Metadata .BuildKitMetadata .VCS ["revision" ])
182185 }
183186
@@ -265,6 +268,11 @@ COPY myapp.Dockerfile /
265268
266269 target := registry + "/buildkit/testwithprovenance:git"
267270
271+ // inject dummy credentials to test that they are masked
272+ expectedURL := strings .Replace (server .URL , "http://" , "http://xxxxx:xxxxx@" , 1 )
273+ require .NotEqual (t , expectedURL , server .URL )
274+ server .URL = strings .Replace (server .URL , "http://" , "http://user:pass@" , 1 )
275+
268276 _ , err = f .Solve (sb .Context (), c , client.SolveOpt {
269277 FrontendAttrs : map [string ]string {
270278 "context" : server .URL + "/.git#v1" ,
@@ -318,7 +326,7 @@ COPY myapp.Dockerfile /
318326 require .Equal (t , "" , pred .Invocation .ConfigSource .EntryPoint )
319327 } else {
320328 require .NotEmpty (t , pred .Invocation .Parameters .Frontend )
321- require .Equal (t , server . URL + "/.git#v1" , pred .Invocation .ConfigSource .URI )
329+ require .Equal (t , expectedURL + "/.git#v1" , pred .Invocation .ConfigSource .URI )
322330 require .Equal (t , "myapp.Dockerfile" , pred .Invocation .ConfigSource .EntryPoint )
323331 }
324332
@@ -332,15 +340,15 @@ COPY myapp.Dockerfile /
332340 require .Equal (t , expBase , pred .Materials [1 ].URI )
333341 require .NotEmpty (t , pred .Materials [1 ].Digest ["sha256" ])
334342
335- require .Equal (t , server . URL + "/.git#v1" , pred .Materials [2 ].URI )
343+ require .Equal (t , expectedURL + "/.git#v1" , pred .Materials [2 ].URI )
336344 require .Equal (t , strings .TrimSpace (string (expectedGitSHA )), pred .Materials [2 ].Digest ["sha1" ])
337345 } else {
338346 require .Equal (t , 2 , len (pred .Materials ), "%+v" , pred .Materials )
339347
340348 require .Equal (t , expBase , pred .Materials [0 ].URI )
341349 require .NotEmpty (t , pred .Materials [0 ].Digest ["sha256" ])
342350
343- require .Equal (t , server . URL + "/.git#v1" , pred .Materials [1 ].URI )
351+ require .Equal (t , expectedURL + "/.git#v1" , pred .Materials [1 ].URI )
344352 require .Equal (t , strings .TrimSpace (string (expectedGitSHA )), pred .Materials [1 ].Digest ["sha1" ])
345353 }
346354
0 commit comments