Repository navigation
fix(docker): run the images as a non-root user and scan them with DockSec - #90
Merged
Merged
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two Dockerfiles in this repo now follow the standard of the adapters' root Dockerfiles, and DockSec scans them.
Root Dockerfile (the test image):
pip install uvbecameCOPY --from=ghcr.io/astral-sh/uv:0.13.4 /uv /uvx /bin/, andPIP_NO_CACHE_DIR=falseis gone.app(uid 10001) owns/app,USER 10001comes beforeuv sync. It still runsuv sync --extra devwithout--frozen, as since fix(docker): make the compose test path pass without a lockfile or a localhost Redis #89.python -c "import guard_agent": the image is a one-shot test runner with no service to probe.compose.ymlsetshealthcheck: disable: trueon the test service.examples/demo_app/Dockerfile(the imagecontainer-release.ymlpublishes to ghcr): numeric uid 10001 for the existingguarduser,USER 10001, and a HEALTHCHECK on/health, which the app serves. DockSec runstrivy configover the whole tree, so this file raised DS026 and had to be fixed for the scan to be clean..github/workflows/docksec.ymlis copied from fastapi-guard master: same pinned OWASP/DockSec SHA, same pinned upload-sarif, push and pull_request paths including'**/Dockerfile', categorydocksec, fork-PR guard on the upload.Verification (compose test service, own compose project, Redis without a host port, one run at a time, master vs this branch, with the CI flags
pytest -v --cov=guard_agent --cov-fail-under=100):container-release.ymlbuilds it (docker build -f examples/demo_app/Dockerfile .) and run:healthy,uid=10001,GET /health200. The log shows 401 from the ingestion endpoint because the demo has no API key, as before.config --file-patterns dockerfile:Dockerfileover the repo: 27 successes, 0 failures for both Dockerfiles (master: DS026 on the demo, which I fixed here).refs/pull/90/merge(commit 1e12216):results_count0.Not verified: Python versions other than 3.10 and 3.14, and the CI result beyond the checks listed on this PR.