Skip to content

Record which credential a sandbox was issued, without the value #1005

Open

Description

@czpython

What happened

A run failed at the clone and the operator had to find out, by hand, which credential the sandbox had been given: which sandbox_secret_refs row, which vault row it pointed to, which GitHub App installation that row maps to, and whether the token came from the Redis cache (github:installation_token:<installation_id>:<repos>) or was minted for this run. None of that is recorded on the run. The sandbox was gone, so there was nothing else to read.

Proposal

When the secrets route (backend/druks/sandbox/routes.py) issues a credential to a sandbox, write an event on the run with the facts of the issue, never the value:

  • the secret name and the sandbox_secret_refs row
  • the vault row id and its kind
  • the resources the token was limited to
  • for a GitHub App token: the installation id, the expiry GitHub returned, and whether the value came from the Redis cache or a fresh mint
  • a short fingerprint of the value (for example the first 8 hex characters of its SHA-256), so two runs can be compared without exposing either token

The Run page lists these under the sandbox section.

Why in Druks core

Credential issue is platform plumbing in druks.sandbox and druks.core.apis.github.

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions