You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will result in a shell session inside the built container.
46
40
You can now verify two things:
47
-
* The secrets provided to build are not available once the container is running.
41
+
* The secrets provided to build are not available once the container is running. They are no longer on disk, nor are they in the process environment, or in `/proc/self/environ`.
48
42
* The secrets were still useful during the build:
49
43
```bash
50
44
cat /foo_secret.txt
51
45
cat /bar_secret.txt
52
46
```
53
47
54
-
Once done, exit the container and proceed to the next step.
55
-
56
-
We have verified that build secrets do not persist into the runtime container environment. Let's now verify that they also do not persist into the built image. To do this, pull the image and save it as a .tar file. Then, extract it
57
-
and inspect its manifests and layers.
58
-
59
-
```bash
60
-
# Determine the image name and tag
61
-
curl ...
62
-
# Pull and save to disk
63
-
docker pull localhost:5000/
64
-
docker save -o image.tar localhost:5000/
65
-
# Inspect the contents
66
-
67
-
```
68
-
69
48
## Security and Production Use
70
49
The example above ignores various security concerns for the sake of simple illustration. To use build secrets securely, consider these factors:
71
50
51
+
### Build Secret Purpose and Management
52
+
Build secrets are meant for use cases where the secret should not be accessible from the built image, nor from the running container. If you need the secret at runtime, use a volume instead. Volumes that are mounted into a container will not be included in the final image, but still be available at runtime.
53
+
54
+
Build secrets are only protected if they are not copied or moved from their location as designated in the `RUN` directive. If a build secret is used, care should be taken to ensure that it is not copied or otherwise persisted into an image layer beyond the control of Envbuilder.
55
+
72
56
### Who should be able to access build secrets, when and where?
73
57
The secure way to use build secrets with envbuilder is to deny users access to the platform that hosts envbuilder. Only grant access to the envbuilder container once it has concluded its build, using a trusted non-platform channel like ssh or the coder agent running inside the container. Once control has been handed to such a runtime container process, envbuilder will have cleared all secrets that it set from the container.
0 commit comments