feat: secure image admission — Trust Policy + digest/cosign foundation (1/3, #4638)#4656
Draft
alxwlw wants to merge 14 commits into
Draft
feat: secure image admission — Trust Policy + digest/cosign foundation (1/3, #4638)#4656alxwlw wants to merge 14 commits into
alxwlw wants to merge 14 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t no longer over-rejects bare Hub refs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d onLog streaming Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add admit.ts: admitImage() provisions throwaway DOCKER_CONFIG under /etc/dokploy/.cosign-auth/<deployId>, optionally docker-logins, calls resolveDigest then verifySignature (if trust policy present), returns pinned repo@sha256:…, always cleans up (fail-closed). Uses shell-quote for all interpolated path values per codebase idiom. - Add index.ts barrel re-exporting image-ref, resolve-digest, verify-signature, and admit modules. - Pin DEFAULT_COSIGN_IMAGE to ghcr.io/sigstore/cosign/cosign:v2.4.1@sha256: b03690aa52bfe94054187142fba24dc54137650682810633901767d8a3e15b31 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds trustPolicyRouter with create/update/remove/one/all procedures using adminProcedure (owner/admin only). Registers in root.ts and extends AuditResourceType with "trustPolicy" (type-only, no migration). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add Trust Policies settings page, list component, and create/edit dialog mirroring the Registry settings pattern; add Trust Policies nav entry in the settings sidebar next to Registry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…signment on update, parse numeric tags Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Foundation (PR 1 of 3) for native, opt-in supply-chain admission at deploy time, addressing #4638: resolve image tags to immutable
@sha256digests and verify their cosign/sigstore signatures before containers run, failing closed.This PR adds the reusable building blocks; it does not yet wire them into the deploy pipeline (that's PR 2 = Applications, PR 3 = Compose). No existing deploy path changes — the new code is opt-in and currently uncalled by design, so this is intentionally a draft to align on the approach before the pipeline integration lands.
What's included
trustPolicyentity (org-scoped, modeled onregistry): schema + migration + zod + CRUD service + admin-only tRPC router + an organization-settings UI. Holds cosign verification config: keyed (public key) or keyless (cert-identity regexp + OIDC issuer),ignoreTlogfor private/air-gapped registries, and an optionalcosignImageoverride.packages/server/src/utils/admission/moduleimage-ref.ts— digest-aware reference parsing (extracted from the existing webhook parser and shared; webhook behavior unchanged).resolve-digest.ts— pull-then-inspect digest resolution with repository-matchedRepoDigestsselection (never a blind[0]).verify-signature.ts— builds the cosign argv and runs cosign as an ephemeraldocker runcontainer.admit.ts—admitImage()orchestration (resolve → verify → pinned ref), fail-closed.Design notes
docker run <pinned-image> verify …, which works for both local and remote/SSH deploys (both have Docker). The dokploy image is untouched; cloud (no Docker) simply won't use the feature.execFilelocally), neversh -c.docker pullguard before selection.DOCKER_CONFIGdir under the host-shared/etc/dokploytree is used sodocker run -vresolves it on the host daemon (and not inside the dokploy container).cosignImage, the pinned ref, the config dir) are validated against argv flag-smuggling; trust-policy mutations are admin-only with per-row org-ownership checks; the default cosign image is digest-pinned.Testing
@sha256and numeric tags),RepoDigestsselection (incl. fail-closed paths), cosign argv construction per trust mode, and the flag-smuggling guards.apps/dokploytypecheck clean.Not done in this PR (flagged for reviewers)
0173_…) was validated by inspection;migration:runagainst a live Postgres still needs to run.resolveDigest/verifySignature/admitImage) have unit-tested pure cores but no integration test — that belongs with the pipeline wiring in PR 2.Happy to adjust the approach (entity shape, cosign execution model, phasing) to maintainer preferences before PR 2/3.
🤖 Generated with Claude Code