Repository navigation
fix(docker): harden the hosted image and scan it in CI - #103
Merged
Merged
Conversation
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.
Dockerfile.hostedbuilds the imagerelease-docker.ymlpublishes toghcr.io/guard-core/guard-core-mcp, and nothing in CI scanned it: DockSec keeps only files named exactlyDockerfile, so #102 never covered it. On master it fails hadolint 2.15.1 (DL3008, DL3009, DL3015, DL3013, DL3042, DL3066, exit 1) and trivy 0.74.0 config (DS-0026 no HEALTHCHECK, DS-0029 no--no-install-recommends, exit 1).ghcr.io/astral-sh/uv:0.13.4instead ofpip install uv, userguardnow has uid 10001 and the image runs asUSER 10001, files are copied with--chowninstead of a recursivechown -Rlayer,uv sync --no-cache.uv.lockneeds libsodium (no pynacl), and nothing in the image calls curl./.well-known/mcp/server-card.json, the route that needs no token, onGUARD_CORE_MCP_HTTP_HOST/GUARD_CORE_MCP_HTTP_PORT(0.0.0.0and::map to 127.0.0.1).docksec.ymlgets aScan Dockerfile.hostedjob: hadolint and trivy config pinned by digest (trivy with--skip-check-update, so results only move with the pin), then an amd64 build of the image and a wait for its HEALTHCHECK to report healthy.Verified locally, master image vs this branch (native arm64, same probe, token minted against an inline JWKS):
guard, no HEALTHCHECK) to uid 10001 (HEALTHCHECK present).guard-core1.7.0),tools/listreturns the same 9 tools,versionsreports guard-core 4.4.0, fastapi-guard 8.1.2, guard-agent 3.2.4 on both.check_payloadwithq=<script>alert(1)</script>on the branch image:is_threat: true, categoryxss.healthywith the default host, andhealthywithGUARD_CORE_MCP_HTTP_HOST=127.0.0.1, which is what the production compose sets.Not changed: the published image only changes on the next release, the CMD, port 8020 and every
GUARD_CORE_MCP_*variable. Not verified locally: the amd64 build, which the new job covers.