Skip to content

Docs: guidelines for configuring Go module/build cache in a security-conscious way #27886

Open

Description

@yskopets

Problem

There is no dedicated guidance on how to configure Go module and build caching in Agentic Workflows in a security-conscious way. The relevant information is currently spread across several reference pages (frontmatter.md, sandbox.md, cache-memory.md) with no Go-specific caching example.

The gap becomes visible when a workflow uses the cache: frontmatter field or a jobs.setup pre-build step to cache ~/go/pkg/mod and ~/.cache/go-build — there are real security trade-offs here that aren't covered today:

  • Cache poisoning: a cached Go module tarball is not re-verified against the checksum database (GONOSUMCHECK, GONOSUMDB) on restore.
  • GOMODCACHE vs GOCACHE scope: caching the module download cache and the build cache have different risk profiles; mixing both in one actions/cache entry is common but worth calling out.
  • Integrity interplay: when a workflow uses tools.github.min-integrity, should the Go module cache be scoped to the same integrity level? The current docs don't address this.
  • Writable paths in the sandbox: as noted in the smoke-copilot fixture, the default GOCACHE/GOMODCACHE locations may not be writable inside the AWF sandbox, requiring GOCACHE=/tmp/go-cache GOMODCACHE=/tmp/go-mod — but this isn't documented for end-users.

Requested documentation

A dedicated section or guide covering:

  1. Recommended cache: frontmatter for Go — which paths to include, recommended key structure (go-${{ hashFiles('go.sum') }}), and restore-key fallback strategy.
  2. actions/setup-go built-in cache option — whether cache: true on the runtime setup action is supported and safe in the AWF context.
  3. Go cache paths in the AWF sandbox — clarify whether ~/go/pkg/mod and ~/.cache/go-build are writable, and when to redirect via GOCACHE/GOMODCACHE env vars.
  4. Security considerations — checksum verification on restore, risks of sharing a module cache across branches/PRs of differing integrity, and recommended mitigations.
  5. jobs.setup pre-build pattern for Go — a concrete example analogous to the Gradle example in sandbox.md (line 287).

Context

  • Discovered while exploring the cache: field in .github/workflows/prompt-clustering-analysis.md.
  • Current docs: reference/frontmatter.md (§ Cache Configuration), reference/sandbox.md (§ Caching section), reference/cache-memory.md, reference/supported-languages.md.

🤖 Created by Claude Code

Activity

  1. locked and limited conversation to collaborators on Apr 22, 2026
  2. unlocked this conversation on Apr 22, 2026
  3. pelikhan commented on Oct 7, 2026

    @pelikhan
    Collaborator

    Status (2026-10-07; Needs progress check): The April 22 request identifies a gap in Go-specific cache guidance, including sandbox paths and the differing risks of module and build caches. The issue is open and needs a progress check against current documentation before drafting guidance and an example.

  4. pelikhan commented on Oct 16, 2026

    @pelikhan
    Collaborator

    Current-state refresher (2026-10-16): partially addressed; the documentation gap is narrower than the opening report. #37583 merged on June 7 and added a dedicated Go cache FAQ: module/build paths, an OS-and-go.sum cache key, restore keys, a jobs.setup example, setup-go with cache: false, and warnings about writable caches crossing trust boundaries. The sandbox reference also documents explicit GOMODCACHE/GOCACHE paths.

    The fuller security questions in this issue are not answered there: the differing integrity risks of module versus compiled build caches, what integrity verification on restore actually guarantees, and the relationship to tools.github.min-integrity. The example alone also does not establish writability for every runner/sandbox configuration. Remaining work is to resolve those specific questions, rather than start a Go caching guide from scratch. Assessment is against current default-branch source; no cache restore was exercised.

  5. pelikhan commented on Oct 22, 2026

    @pelikhan
    Collaborator

    Relevance check (2026-10-22): keep open for the narrower cache-integrity guidance gap, not missing Go examples. On current main (ffdd9c9), the Go FAQ and sandbox cache-path section from merged #37583 already supply paths, OS/go.sum keys, restore prefixes, jobs.setup, setup-go with cache: false, and a trust-boundary warning. I checked actual merged doc changes in #68663, #70500, and #71114: none adds the missing Go-cache integrity treatment; merely mentioning this issue in a documentation PR is not completion.

    One important distinction is now explicit elsewhere: cache-memory has integrity-level/policy-key isolation, whereas tools.github.min-integrity filters GitHub tool content. Neither reference establishes automatic integrity partitioning or authentication of an arbitrary top-level Go cache: archive.

    Next concrete action: extend the existing FAQ, rather than create a duplicate guide, to distinguish module-source versus compiled build-cache trust; explain what restore does/does not verify and where go mod verify/checksum settings apply; define key, restore-prefix, and writer policies across trust levels; and state that cache-memory isolation is a different feature. Also clarify the supported setup-go cache: true alternative versus deliberate cache: false ownership and show the correct same-job setup/agent handoff plus runner-specific writable-path expectations. The current example alone does not establish those runtime properties; no cache restore or sandbox execution was performed here.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions