```
builder/remotecontext/remote.go:48: G107: Potential HTTP request made with variable url (gosec)
builder/remotecontext/git/gitutils.go:145: G107: Potential HTTP request made with variable url (gosec)
builder/remotecontext/git/gitutils.go:147: G107: Potential HTTP request made with variable url (gosec)
pkg/fileutils/fileutils_test.go:185: G303: File creation in shared tmp directory without using ioutil.Tempfile (gosec)
pkg/tarsum/tarsum_test.go:7: G501: Blacklisted import `crypto/md5`: weak cryptographic primitive (gosec)
pkg/tarsum/tarsum_test.go:9: G505: Blacklisted import `crypto/sha1`: weak cryptographic primitive (gosec)
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -142,9 +142,9 @@ func supportsShallowClone(remoteURL string) bool {
|
| 142 | 142 |
serviceURL := remoteURL + "/info/refs?service=git-upload-pack" |
| 143 | 143 |
|
| 144 | 144 |
// Try a HEAD request and fallback to a Get request on error |
| 145 |
- res, err := http.Head(serviceURL) |
|
| 145 |
+ res, err := http.Head(serviceURL) // #nosec G107 |
|
| 146 | 146 |
if err != nil || res.StatusCode != http.StatusOK {
|
| 147 |
- res, err = http.Get(serviceURL) |
|
| 147 |
+ res, err = http.Get(serviceURL) // #nosec G107 |
|
| 148 | 148 |
if err == nil {
|
| 149 | 149 |
res.Body.Close() |
| 150 | 150 |
} |
| ... | ... |
@@ -45,6 +45,7 @@ func downloadRemote(remoteURL string) (string, io.ReadCloser, error) {
|
| 45 | 45 |
// GetWithStatusError does an http.Get() and returns an error if the |
| 46 | 46 |
// status code is 4xx or 5xx. |
| 47 | 47 |
func GetWithStatusError(address string) (resp *http.Response, err error) {
|
| 48 |
+ // #nosec G107 |
|
| 48 | 49 |
if resp, err = http.Get(address); err != nil {
|
| 49 | 50 |
if uerr, ok := err.(*url.Error); ok {
|
| 50 | 51 |
if derr, ok := uerr.Err.(*net.DNSError); ok && !derr.IsTimeout {
|
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
|
| 17 | 17 |
// CopyFile with invalid src |
| 18 | 18 |
func TestCopyFileWithInvalidSrc(t *testing.T) {
|
| 19 |
- tempFolder, err := ioutil.TempDir("", "docker-fileutils-test")
|
|
| 19 |
+ tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") // #nosec G303
|
|
| 20 | 20 |
defer os.RemoveAll(tempFolder) |
| 21 | 21 |
if err != nil {
|
| 22 | 22 |
t.Fatal(err) |
| ... | ... |
@@ -182,6 +182,7 @@ func TestReadSymlinkedDirectoryToFile(t *testing.T) {
|
| 182 | 182 |
var err error |
| 183 | 183 |
var file *os.File |
| 184 | 184 |
|
| 185 |
+ // #nosec G303 |
|
| 185 | 186 |
if file, err = os.Create("/tmp/testReadSymlinkToFile"); err != nil {
|
| 186 | 187 |
t.Fatalf("failed to create file: %s", err)
|
| 187 | 188 |
} |