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

Merge Develop into Release #3323

Merged
merged 5 commits into from
Mar 7, 2024
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
4 changes: 4 additions & 0 deletions dockerfile/best-practice/missing-apk-no-cache.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ RUN apk add --no-cache --virtual .build-deps \
gcc \
freetype-dev \
musl-dev


# ok: missing-apk-no-cache
RUN apk --no-cache add
4 changes: 2 additions & 2 deletions dockerfile/best-practice/missing-apk-no-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ rules:
patterns:
- pattern: |
RUN apk $COMMAND ...
- pattern-not: |
RUN apk $CMD ... --no-cache ...
- pattern-not-inside: |
RUN apk ... --no-cache ...
languages:
- dockerfile
message: >-
Expand Down
3 changes: 3 additions & 0 deletions dockerfile/security/last-user-is-root.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ RUN git clone https://github.com/returntocorp/semgrep
RUN pip3 install semgrep
RUN semgrep -f p/xss
USER swuser
USER root

USER user1
# ruleid: last-user-is-root
USER root
28 changes: 11 additions & 17 deletions dockerfile/security/last-user-is-root.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
rules:
- id: last-user-is-root
patterns:
- pattern-inside: |
USER $F
...
USER $X
# nosemgrep: yaml.semgrep.slow-pattern-top-ellipsis
- pattern-not-inside: |
...
USER $X
...
USER $F
- focus-metavariable: $X
- metavariable-regex:
metavariable: $X
regex: ^(root)$
- metavariable-regex:
metavariable: $F
regex: (.*(?!root))
- pattern: USER root
- pattern-not-inside:
patterns:
- pattern: |
USER root
...
USER $X
- metavariable-pattern:
metavariable: $X
patterns:
- pattern-not: root
message: >-
The last user in the container is 'root'. This is a security
hazard because if an attacker gains control of the container
Expand Down
8 changes: 0 additions & 8 deletions generic/dockerfile/security/last-user-is-root.dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions generic/dockerfile/security/last-user-is-root.yaml

This file was deleted.

Loading