cloudfoundry / cloudfoundry/community

Pin Go toolchain image in BATS CI task

Open
#1,631 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
57
Forks
250
Avg merge
2d 11h
Merged PRs (30d)
11

Description

Summary

The ci/bats/ Dockerfile references the Go toolchain image without a tag or digest, so Docker resolves it to latest at build time. This is a mutable reference — the image can silently change between runs.

This matters here because the BATS task runs after exporting BOSH admin credentials, meaning a compromised or unreviewed image has access to sensitive values.

Suggested Fix

Pin to a specific version tag or digest:

# instead of
FROM golang

# use
FROM golang:1.23.8
# or a reviewed digest
FROM golang@sha256:<digest>

Broader Context

This pattern exists across github.com/cloudfoundry repos. Per Aram's feedback on the PR where this was flagged, it should be addressed consistently at the org level rather than in one repo in isolation.

Scope

Audit FROM references for mutable toolchain images (Go, Ruby, etc.) across cloudfoundry org repos
Establish a consistent pinning practice (version tag at minimum, digest preferred)
Document the convention so new CI tasks follow it

References

CWE-829: Inclusion of Functionality from Untrusted Control Sphere
Originally flagged by CodeRabbit in bosh-openstack-cpi-release

cc @aramprice

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ci/bats/Dockerfile and inspect its untagged Go image reference. Then audit the FROM references across the cloudfoundry repositories mentioned in the issue and review the linked PR discussion for the expected organization-wide approach. Done means mutable toolchain references are pinned consistently and the convention is documented for new CI tasks.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
ci-cd, devops, security
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.