Skip to content

Management of DCT Keys for Image Signing #25

Closed as not planned
Closed as not planned

Description

@akash2237778

Currently, Pubgrade uses Kaniko to build container images, which are then stored in a temporary container registry. These images are signed using DCT (Docker Content Trust) keys, which are stored in GitHub Actions secrets. Finally, the signed images from github-actions (triggered from pubgrade) are pushed to the final container registry. The current approach requires storing and managing DCT keys for each container registry repository manually.
This poses several challenges:

  1. We need to upload separate DCT keys for each repository.
  2. Managing secrets across multiple repositories increases exposure risk.
  3. Manually updating or rotating keys is cumbersome.

We need a centralized and secure approach to store and access DCT keys for signing images.

Activity

  1. akash2237778 commented on Apr 13, 2025

    @akash2237778
    CollaboratorAuthor

    Add Docker Trust Keys to Pubgrade /build Payload

    Proposed Solution

    Modify the Pubgrade CI/CD payload to include the Docker trust keys, id and passphrase allowing them to be securely passed to GitHub Actions for signing Docker images. The keys will be included in the JSON payload of the curl command and stored securely by Pubgrade before being forwarded to the GitHub Actions workflow.

    Proposed curl Command Update

    Update the curl command to include a docker_trust object in the payload:

    curl --location 'https://pubgrade.dyn.cloud.e-infra.cz/repositories/cwaitc/builds' \
    --header 'X-Project-Access-Token: crstoor.glnw.i-s---o.roawlnwnsci' \
    --header 'Content-Type: application/json' \
    --data '{
        "images": [
            {
                "name": "akash7778/sampletestt:1.0",
                "location": "./Dockerfile"
            }
        ],
        "head_commit": {
            "branch": "main"
        },
        "dockerhub_token": "<token>",
        "docker_trust": {
            "private_key": "<DOCKER_PRIVATE_KEY>",
            "key_id": "<DOCKER_PRIVATE_KEY_ID>",
            "passphrase": "<DOCKER_PRIVATE_KEY_PASSPHRASE>"
        }
    }'
    • docker_trust.private_key: The Docker private key content.
    • docker_trust.key_id: The ID of the private key.
    • docker_trust.passphrase: The passphrase for the private key.

    Steps to Manually Verify DCT signed image

    Inspect Trust Metadata:

    Retrieve the image’s trust data (digest, signers, signatures).
    Example Command:docker trust inspect <repository>:<tag>

    Check for signed tags, digest, and signer key IDs.

    Verify Signer’s Key:

    Confirm the signer’s key ID matches the expected trusted key.
    Example Command (with notary):notary -s https://notary.docker.io -d ~/.docker/trust key list

    Check Trust Metadata:

    Validate the tag’s digest and signer in the trust store.
    Example Command:notary -s https://notary.docker.io -d ~/.docker/trust list docker.io/<repository>

    Notes

    • No private keys are needed; verification uses public metadata.
    • Use notary for deeper checks if needed, pointing to the registry’s notary server.
    • A mismatched digest suggests tampering; do not use the image.
  2. uniqueg commented on May 2, 2025

    @uniqueg
    Member

    @akash2237778: Thanks a lot for raising this important issue regarding the management of DCT keys for image signing within Pubgrade and for taking the time to propose a detailed solution. Improving how we handle artifact signing and key management is definitely something we need to address.

    However, after reviewing the proposal and thinking through the implications for the overall trust chain, I have some concerns about the suggested approach and would like to propose an alternative direction.

    Concerns with the Proposed Solution

    While centralizing key management (if/where necesseary) is a valid goal, there are, I believe, a few challenges with the proposed method of passing DCT keys via the API payload:

    • Limited Scope & Misleading Trust Assertion: Your proposal focuses on enabling signing using keys provided by the code repository. However, this implies an assertion that "Project X signed off on this build," which can be misleading:

      • It doesn't inherently verify the code's origin, its approval status, or whether required source control policies (like code reviews) were met before the build was triggered.
      • The entity providing the key (the code owner/repo context) doesn't actually control the Pubgrade build environment or process. Therefore, they can't truly attest to the integrity of the final built artifact.
      • Standard DCT keys lack a strong, verifiable link back to a specific project identity, making it difficult for deployers to confirm the correct, authorized key was actually used for signing.
    • Security Risks: Sending sensitive private keys and passphrases directly in an API request body, even over HTTPS, poses significant security risks. The primary concerns are accidental exposure through potential server-side request logging or the compromise of the API endpoint itself. Best practices generally advise against transmitting such secrets directly.

    For these reasons, particularly the potentially misleading trust implications and the security concerns, I feel this approach may not be the best path forward.

    Proposed Alternative: Pubgrade Signing + Provenance Tracking

    • Solving the Signing Problem:
      • Pubgrade could sign the images using its own identity for a more honest/narrowly scoped attestion ("The image was built and signed by Pubgrade using its processes.")
      • If we don't want to generate and manage DCT keys within Pubgrade itself, perhaps a cleaner way to implement this might be using Sigstore. Pubgrade's build process could use an OIDC identity to obtain short-lived signing certificates dynamically. If my understanding is correct, this might eliminate the need for managing static DCT keys entirely.
      • Deployers could then verify that the image signature originates from Pubgrade's official identity (via Sigstore OIDC).

    Beyond that, we could plan for mechanisms to provide verifiable provenance back to the source code:

    • Improving End-to-End Trust (Provenance):
      • To link the Pubgrade-signed image back to the original source code, Pubgrade's build process could maybe generate and sign SLSA Provenance Attestations. These could creates verifiable links between the final image digest and the specific source repository, commit hashes etc. used in the build.
      • Deployers could check whether the SLSA attestations confirm that the image was built from the expected source code commit/repository.

    This approach provides a clearer trust model: Pubgrade attests to the build process it controls, and provides verifiable evidence (the SLSA attestation) linking the artifact back to its source. It doesn't assert secure code review policies and branch protection rules, and it doesn't verify that the commiters are trusted and that the dependencies (including the base image) used in the code are safe - but I think it would put us on the right track to do what we can to establish an end to end trust chain (and we could still try to address the missing pieces in the future).

    What do you think? Happy to discuss this further!

  3. akash2237778 commented on Jun 3, 2025

    @akash2237778
    CollaboratorAuthor

    Added GitHub Actions workflow that automates the process of pulling, tagging, pushing, and signing a container image. Triggered by a repository_dispatch event (sign-image) or manual workflow_dispatch, it runs on an ubuntu-latest environment with the following steps:

    1. Checkout Code: Clones the repository using actions/checkout@v4.

    2. Docker Hub Login: Authenticates with Docker Hub using provided credentials from repository_dispatch API call.

    3. Pull Image: Pulls the specified container image using the pull_tag input.

    4. Extract Image Name: Derives the image name from the push_tag input and stores it in the environment.

    5. Get Image Digest: Retrieves the image digest for verification.

    6. Install Cosign: Installs Cosign (v2.2.1) for signing the image.

    7. Tag and Push Image: Tags the pulled image with push_tag and pushes it to Docker Hub.

    8. Sign Image: Signs the pushed image using Cosign with experimental features enabled.

    9. Output Digest: Logs the signed image's digest for verification.

    The workflow uses OIDC token permissions for secure operations and outputs the digest for post-signing verification. It ensures a streamlined process for pulling, tagging, pushing, and cryptographically signing container images.

    PR: #26

  4. uniqueg commented on Jul 7, 2025

    @uniqueg
    Member

    Awesome, thanks a lot @akash2237778! I'm wondering: Do you think this would also work seamlessly with a privately hosted container registry, e.g., Harbor? We are planning to deprecate Docker Hub so that we have better control and are not relying on Docker's open source program (which is a bit unreliable).

    We would probably also want to deploy HashiCorp Vault for secret management, if that helps you in any way.

    For both I'm just not sure when we would have the resources to work on this. Possibly during BioHackathons in September and November. Or do you wanna have a stab at it? For Harbor, you could talk to @JaeAeich - he has a Helm chart for that. We would just need integration with LS AAI.

  5. akash2237778 commented on Jul 11, 2025

    @akash2237778
    CollaboratorAuthor

    Thanks! I'll try to setup Harbor. And see if pubgrade is compatible otherwise I'll make it. Created #27 for tracking this one

  6. added
    priority: low
    flag: nice to have
    on Nov 8, 2026
  7. moved this to Backlog in ELIXIR On-Cloudon Nov 8, 2026
  8. moved this from Backlog to In progress in ELIXIR On-Cloudon Nov 8, 2026
  9. uniqueg commented on Nov 12, 2026

    @uniqueg
    Member

    Closing as not planned: Pubgrade's direction has changed. Images are now built and signed in each repository's CI (keyless Sigstore signatures and attestations in the release workflows), and Pubgrade only orchestrates the rollout of released images. Pubgrade no longer signs anything, so it has no DCT keys to manage, and Docker Content Trust is being retired upstream in favour of Sigstore/Notation anyway. If Pubgrade ever needs to check signatures before a rollout, that would be a new issue about verifying Sigstore signatures, not about storing keys.

  10. moved this from In progress to Done in ELIXIR On-Cloudon Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: nice to havepriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions