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

Dockerfile preprocessor should respect current user when mounting secrets #237

Open
NiklasRosenstein opened this issue Apr 29, 2024 · 0 comments

Comments

@NiklasRosenstein
Copy link
Contributor

NiklasRosenstein commented Apr 29, 2024

The Dockerfile preprocessing injecting mounts for secrets does not take into account the current user for the RUN step.

USER shane
RUN cat /etc/secrets/MYSECRET

When passing a build secret to build_docker_image(), the preprocessing step will change the Dockerfile to

USER shane
RUN --mount=type=secret,id=MYSECRET cat /etc/secrets/MYSECRET

But it should actually be

  USER shane
- RUN --mount=type=secret,id=MYSECRET cat /etc/secrets/MYSECRET
+ RUN --mount=type=secret,id=MYSECRET,uid=1000 cat /etc/secrets/MYSECRET

However, this has two issues:

  • How does Kraken know the user ID of the user if the USER block uses a name rather than an ID? (It's not guaranteed to be 1000)
  • How does Kraken know the ID of the user if the base image is already switching to a different user?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant