Skip to content

Commit

Permalink
Add 'dockerfile' as a Dockerfile file name (semgrep#7819)
Browse files Browse the repository at this point in the history
Dockerfiles can be called `dockerfile` as well as `Dockerfile`. Support
both.

Closes semgrep#7824

Test plan: see tests

PR checklist:

- [x] Purpose of the code is [evident to future
readers](https://semgrep.dev/docs/contributing/contributing-code/#explaining-code)
- [x] Tests included or PR comment includes a reproducible test plan
- [x] Documentation is up-to-date
- [x] A changelog entry was [added to
changelog.d](https://semgrep.dev/docs/contributing/contributing-code/#adding-a-changelog-entry)
for any user-facing change
- [x] Change has no security implications (otherwise, ping security
team)

If you're unsure about any of this, please see:

- [Contribution
guidelines](https://semgrep.dev/docs/contributing/contributing-code)!
- [One of the more specific guides located
here](https://semgrep.dev/docs/contributing/contributing/)

---------

Co-authored-by: Emma Jin <--get>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Martin Jambon <[email protected]>
  • Loading branch information
3 people authored May 19, 2023
1 parent 36b46c9 commit d167b01
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/gh-7824.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When scanning with `-l dockerfile`, files named `dockerfile` as well as `Dockerfile` will be scanned.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"errors": [],
"paths": {
"_comment": "<add --verbose for a list of skipped paths>",
"scanned": [
"targets/spacegrep/dockerfile"
]
},
"results": [
{
"check_id": "rules.spacegrep.double-root",
"end": {
"col": 10,
"line": 3,
"offset": 43
},
"extra": {
"engine_kind": "OSS",
"fingerprint": "0x42",
"is_ignored": false,
"lines": "USER root",
"message": "'USER' is specified twice\n",
"metadata": {},
"metavars": {
"$ROOT": {
"abstract_content": "root",
"end": {
"col": 10,
"line": 3,
"offset": 43
},
"start": {
"col": 6,
"line": 3,
"offset": 39
}
}
},
"severity": "ERROR"
},
"path": "targets/spacegrep/dockerfile",
"start": {
"col": 1,
"line": 3,
"offset": 34
}
},
{
"check_id": "rules.spacegrep.double-root",
"end": {
"col": 10,
"line": 7,
"offset": 111
},
"extra": {
"engine_kind": "OSS",
"fingerprint": "0x42",
"is_ignored": false,
"lines": "USER root",
"message": "'USER' is specified twice\n",
"metadata": {},
"metavars": {
"$ROOT": {
"abstract_content": "root",
"end": {
"col": 10,
"line": 7,
"offset": 111
},
"start": {
"col": 6,
"line": 7,
"offset": 107
}
}
},
"severity": "ERROR"
},
"path": "targets/spacegrep/dockerfile",
"start": {
"col": 1,
"line": 7,
"offset": 102
}
}
],
"version": "0.42"
}
8 changes: 8 additions & 0 deletions cli/tests/e2e/targets/spacegrep/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM alpine
# ruleid: double-root
USER root
RUN apk install curl
CMD ["/hello"]
# ruleid: double-root
USER root
CMD ["ls -ltr"]
1 change: 1 addition & 0 deletions cli/tests/e2e/test_spacegrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
("rules/spacegrep/markdown.yaml", "spacegrep/markdown.md"),
("rules/spacegrep/httpresponse.yaml", "spacegrep/httpresponse.txt"),
("rules/spacegrep/dockerfile.yaml", "spacegrep/root.Dockerfile"),
("rules/spacegrep/dockerfile.yaml", "spacegrep/dockerfile"),
("rules/spacegrep/multi-lines.yaml", "spacegrep/multi-lines.java"),
],
)
Expand Down

0 comments on commit d167b01

Please sign in to comment.