Repository navigation
fix(docker): run the images as a non-root user and scan them with DockSec - #102
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 root Dockerfile follows the standard of the adapters' root Dockerfiles, and DockSec scans the repo.
Root Dockerfile (the dev and test image, and the compose example that runs
guard-core-mcp):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.--frozenand theuv.lockmount stay, because this repo tracksuv.lock.python -c "from guard_core_mcp.server import mcp". The server speaks MCP over stdio and opens no port (server.py:506,mcp.run()), so there is nothing to probe over the network. The check confirms the server module and its tool registrations load..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.release-docker.ymlbuildsDockerfile.hosted, not the root Dockerfile, so this PR does not change the published image.Dockerfile.hostedis not scanned by DockSec (the scan keeps files named exactlyDockerfile) and I left it alone. For reference, hadolint 2.15.1 on it reports DL3008, DL3009, DL3015 (unpinned apt install of libsodium23 and curl), DL3013, DL3042 (pip install uv) and DL3066 (named userguard), and it has no HEALTHCHECK.Verification (compose test service, own compose project, one run at a time, master vs this branch,
pytest -v --cov=guard_core_mcp --cov-branch):compose.yml(guard-core-mcp, Python 3.10):healthy,uid=10001. I ran the entrypoint withdocker compose run -T, sent an MCPinitializerequest on stdin and got a valid JSON-RPC result with the tools capability back, as uid 10001. The server writes nothing outside/app, opens no port and needs no privilege.config --file-patterns dockerfile:Dockerfileon the root Dockerfile: 27 successes, 0 failures.refs/pull/102/merge(commit 69fcc6e):results_count0.Not verified: Python versions other than 3.10 and 3.14, the hosted image (not changed, not built), and the CI result beyond the checks listed on this PR.