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
docs(docker): Describe current state of docker image security plus minor fixes (#836)
* fix(docker image build): Point `changed-files` step to correct scripts dir (and sort list)
* Add information about docker security as it not obvious
---------
Co-authored-by: MaxymVlasov <[email protected]>
All available tags [here](https://github.com/antonbabenko/pre-commit-terraform/pkgs/container/pre-commit-terraform/versions).
131
132
133
+
Check [About Docker image security](#about-docker-image-security) section to learn more about possible security issues and why you probably want to build and maintain your own image.
134
+
135
+
132
136
**Build from scratch**:
133
137
134
-
> [!IMPORTANT]
138
+
> **IMPORTANT**
135
139
> To build image you need to have [`docker buildx`](https://docs.docker.com/build/install-buildx/) enabled as default builder.
136
140
> Otherwise - provide `TARGETOS` and `TARGETARCH` as additional `--build-arg`'s to `docker build`.
We highly recommend using [WSL/WSL2](https://docs.microsoft.com/en-us/windows/wsl/install) with Ubuntu and following the Ubuntu installation guide. Or use Docker.
228
232
229
-
> [!IMPORTANT]
230
-
> We won't be able to help with issues that can't be reproduced in Linux/Mac.
233
+
> **IMPORTANT**
234
+
> We won't be able to help with issues that can't be reproduced in Linux/Mac.
231
235
> So, try to find a working solution and send PR before open an issue.
232
236
233
237
Otherwise, you can follow [this gist](https://gist.github.com/etiennejeanneaurevolve/1ed387dc73c5d4cb53ab313049587d09):
@@ -1182,6 +1186,17 @@ Example:
1182
1186
1183
1187
## Docker Usage
1184
1188
1189
+
### About Docker image security
1190
+
1191
+
Pre-built Docker images contain the latest versions of tools available at the time of their build and remain unchanged afterward. Tags should be immutable whenever possible, and it is highly recommended to pin them using hash sums for security and reproducibility.
1192
+
1193
+
This means that most Docker images will include known CVEs, and the longer an image exists, the more CVEs it may accumulate. This applies even to the latest `vX.Y.Z` tags.
1194
+
To address this, you can use the `nightly` tag, which rebuilds nightly with the latest versions of all dependencies and latest `pre-commit-terraform` hooks. However, using mutable tags introduces different security concerns.
1195
+
1196
+
Note: Currently, we DO NOT test third-party tools or their dependencies for security vulnerabilities, corruption, or injection (including obfuscated content). If you have ideas for introducing image scans or other security improvements, please open an issue or submit a PR. Some ideas are already tracked in [#835](https://github.com/antonbabenko/pre-commit-terraform/issues/835).
1197
+
1198
+
From a security perspective, the best approach is to manage the Docker image yourself and update its dependencies as needed. This allows you to remove unnecessary dependencies, reducing the number of potential CVEs and improving overall security.
1199
+
1185
1200
### File Permissions
1186
1201
1187
1202
A mismatch between the Docker container's user and the local repository file ownership can cause permission issues in the repository where `pre-commit` is run. The container runs as the `root` user by default, and uses a `tools/entrypoint.sh` script to assume a user ID and group ID if specified by the environment variable `USERID`.
0 commit comments