# GHSA-f6mm-5fc7-3g3c: goreleaser shows environment by default

> Goreleaser leaks environment variables containing secrets in log output when Go build commands produce non-empty output.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 May 2024
- **Also known as:** GO-2024-2860

## What is GHSA-f6mm-5fc7-3g3c?

GHSA-f6mm-5fc7-3g3c is a vulnerability in github.com/goreleaser/goreleaser, published on 15 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

### Summary
Since #4787 the log output is printed on the INFO level, while previously it was logged on DEBUG. This means if the `go build` output is non-empty, goreleaser leaks the environment.

### PoC
* Create a Go project with dependencies, do not pull them yet (or run goreleaser later in a container, or delete `$GOPATH/pkg`).
* Make sure to have secrets set in the environment
* Make sure to not have `go mod tidy` in a before hook
* Run `goreleaser release --clean`
* Go prints lots of `go: downloading ...` lines, which triggers the "if output not empty, log it" line, which includes the environment.

### Impact
Credentials and tokens are leaked.

## Which versions are affected by GHSA-f6mm-5fc7-3g3c?

3 open source packages ship an affected version, including github.com/goreleaser/goreleaser.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/goreleaser/goreleaser` | Go | From 1.26.0 | 1.26.1 |
| `github.com/goreleaser/goreleaser` | Go | From 1.26.0 | 1.26.1 |
| `github.com/goreleaser/goreleaser` | Go | From 1.26.0 | 1.26.1 |

## How do I fix GHSA-f6mm-5fc7-3g3c?

Upgrade github.com/goreleaser/goreleaser to 1.26.1 or later.

## Is GHSA-f6mm-5fc7-3g3c being exploited?

There is no known exploitation of GHSA-f6mm-5fc7-3g3c in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-f6mm-5fc7-3g3c and fix it if it is affected.

What it is: GHSA-f6mm-5fc7-3g3c is a vulnerability in github.com/goreleaser/goreleaser, published on 15 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-f6mm-5fc7-3g3c in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/goreleaser/goreleaser (Go): affected from 1.26.0; fixed in 1.26.1
- github.com/goreleaser/goreleaser (Go): affected from 1.26.0; fixed in 1.26.1
- github.com/goreleaser/goreleaser (Go): affected from 1.26.0; fixed in 1.26.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-f6mm-5fc7-3g3c/ (Markdown: https://insights.sbomify.com/GHSA-f6mm-5fc7-3g3c/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-f6mm-5fc7-3g3c

---
From sbomify Insights: https://insights.sbomify.com/GHSA-f6mm-5fc7-3g3c/
Summaries are generated and may contain mistakes; the official description above is the record.
