-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow the
ADD
instruction with HTTP, HTTPS and Git URLs
COPY should be preferred over ADD when simply copying a file from the build context to the container. However, ADD supports additional features such as fetching files from remote HTTP(S) and Git URLS and extracting tar files. See https://docs.docker.com/build/building/best-practices/#add-or-copy, aquasecurity/trivy#7806 and aquasecurity/trivy#7791.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,3 +70,30 @@ test_add_tar_allowed { | |
|
||
count(r) == 0 | ||
} | ||
|
||
test_add_http_url_allowed { | ||
r := deny with input as {"Stages": [{ | ||
"Name": "alpine:3.13", | ||
"Commands": [{"Cmd": "add", "Value": ["http://example.com/foo.txt", "bar.txt"]}], | ||
}]} | ||
|
||
count(r) == 0 | ||
} | ||
|
||
test_add_https_url_allowed { | ||
r := deny with input as {"Stages": [{ | ||
"Name": "alpine:3.13", | ||
"Commands": [{"Cmd": "add", "Value": ["https://example.com/foo.txt", "bar.txt"]}], | ||
}]} | ||
|
||
count(r) == 0 | ||
} | ||
|
||
test_add_git_url_allowed { | ||
r := deny with input as {"Stages": [{ | ||
"Name": "alpine:3.13", | ||
"Commands": [{"Cmd": "add", "Value": ["[email protected]:user/repo.git", "/usr/src/things/"]}], | ||
}]} | ||
|
||
count(r) == 0 | ||
} |