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(misconf): get user from Config.User #6070

Merged

Conversation

DmitriyLewen
Copy link
Contributor

Description

Possible cases when History doesn't contain information about user.
Config.User can contain user information:

~ docker image inspect alpine | jq '.[].Config.User'
""~ docker history alpine          
IMAGE          CREATED        CREATED BY                                      SIZE      COMMENT
5053b247d78b   7 months ago   /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B        
<missing>      7 months ago   /bin/sh -c #(nop) ADD file:289c2fac17119508c…   7.66MB    ~ docker run --user 1003 alpine
➜  ~ docker ps -a          
CONTAINER ID   IMAGE     COMMAND     CREATED          STATUS                      PORTS     NAMES
bcbf97a115a5   alpine    "/bin/sh"   28 seconds ago   Exited (0) 27 seconds ago             focused_fermat
➜  ~ docker commit bcbf97a115a5 alpine:test-user
sha256:04babd6fbc5d383e83019b5e3d5a9c37f50158f7f0a3cc19a7d6546ea562dc4d
➜  ~ docker image inspect alpine:test-user | jq '.[].Config.User'
"1003"~ docker history alpine:test-user
IMAGE          CREATED          CREATED BY                                      SIZE      COMMENT
04babd6fbc5d   23 seconds ago   /bin/sh                                         0B        
5053b247d78b   7 months ago     /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B        
<missing>      7 months ago     /bin/sh -c #(nop) ADD file:289c2fac17119508c…   7.66MB ~ docker run -it --rm alpine:test-user
~ $ whoami
whoami: unknown uid 1003
~ $ id -u -n
1003id: unknown ID 1003

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen self-assigned this Feb 6, 2024
@DmitriyLewen DmitriyLewen marked this pull request as ready for review February 6, 2024 10:46
@knqyf263 knqyf263 added this pull request to the merge queue Feb 7, 2024
Merged via the queue into aquasecurity:main with commit 7fec991 Feb 7, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants