@@ -329,12 +329,12 @@ func TestURLSource_Read_RejectsLocalAddresses(t *testing.T) {
329329 // though the TLS handshake will never complete, because the dial is
330330 // aborted before any bytes are sent.
331331 tests := []string {
332- "https://127.0.0.1/agent.yaml" , // loopback
333- "https://[::1]/agent.yaml" , // IPv6 loopback
334- "https://10.0.0.1/agent.yaml" , // RFC1918
335- "https://192.168.1.1/agent.yaml" , // RFC1918
336- "https://169.254.169.254/agent.yaml" , // AWS/GCP/Azure metadata
337- "https://0.0.0.0/agent.yaml" , // unspecified
332+ "https://127.0.0.1/agent.yaml" , // loopback
333+ "https://[::1]/agent.yaml" , // IPv6 loopback
334+ "https://10.0.0.1/agent.yaml" , // RFC1918
335+ "https://192.168.1.1/agent.yaml" , // RFC1918
336+ "https://169.254.169.254/agent.yaml" , // AWS/GCP/Azure metadata
337+ "https://0.0.0.0/agent.yaml" , // unspecified
338338 }
339339 for _ , rawURL := range tests {
340340 t .Run (rawURL , func (t * testing.T ) {
@@ -396,7 +396,7 @@ func TestSSRFCheckRedirect(t *testing.T) {
396396 tests := []struct {
397397 name string
398398 target string
399- via int // length of the via slice
399+ via int // length of the via slice
400400 wantErr string // empty means no error
401401 }{
402402 {"https redirect allowed" , "https://example.com/agent.yaml" , 1 , "" },
@@ -441,13 +441,13 @@ func TestURLSource_Read_RejectsHTTPRedirect(t *testing.T) {
441441 // and assert that the production fetch path errors out for an https
442442 // origin pointing at a non-trusted CA. Either way, the request must
443443 // not silently follow to http://.
444- url := httpsSrv .URL + "/agent.yaml"
444+ agentURL := httpsSrv .URL + "/agent.yaml"
445445 urlCacheDir := getURLCacheDir ()
446- urlHash := hashURL (url )
446+ urlHash := hashURL (agentURL )
447447 _ = os .Remove (filepath .Join (urlCacheDir , urlHash ))
448448 _ = os .Remove (filepath .Join (urlCacheDir , urlHash + ".etag" ))
449449
450- _ , err := NewURLSource (url , nil ).Read (t .Context ())
450+ _ , err := NewURLSource (agentURL , nil ).Read (t .Context ())
451451 require .Error (t , err )
452452}
453453
0 commit comments