Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): improve RegEx rule in curl_or_wget_instead_of_add #5706

Merged
merged 2 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"queryName": "Curl or Wget Instead of Add",
"severity": "LOW",
"category": "Best Practices",
"descriptionText": "Use Curl or Wget instead of Add to fetch packages from remote URLs, because using Add is strongly discouraged",
"descriptionText": "Use of Curl or Wget should be done instead of Add to fetch packages from remote URLs due to the use of Add being strongly discouraged",
"descriptionUrl": "https://docs.docker.com/develop/develop-images/dockerfile_best-practices/",
"platform": "Dockerfile",
"descriptionID": "29e8216b"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ CxPolicy[result] {
"documentId": input.document[i].id,
"searchKey": sprintf("FROM={{%s}}.{{%s}}", [name, resource.Original]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("Use 'curl' or 'wget' to download %s", [resource.Value[0]]),
"keyExpectedValue": sprintf("Should use 'curl' or 'wget' to download %s", [resource.Value[0]]),
"keyActualValue": sprintf("'ADD' %s", [resource.Value[0]]),
}
}

httpRequestChecker(cmdValue) {
regex.match("https?", cmdValue[_])
regex.match("https?://", cmdValue[_])
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM openjdk:10-jdk
ADD ./drop-http-proxy-header.conf /etc/apache2/conf-available
RUN mkdir -p /usr/src/things \
&& curl -SL https://example.com/big.tar.xz \
| tar -xJC /usr/src/things \
&& make -C /usr/src/things all