Skip to content

Go SDK: auth.Token prints the bearer token in full through fmt and slog #1848

In review

Description

@auxesis

Background

The Go SDK is in languages/golang in this repository. It encrypts values in a Go program, and gets its keys from ZeroKMS, CipherStash's key management service. In November 2026 we audited version v0.1.0-rc.7 by building programs against a dev workspace and PostgreSQL 17 with EQL (Encrypt Query Language) v4.

Problem

auth.Token stores the access token in its AccessToken field. The type has no String, GoString, Format, or LogValue method. So fmt.Println(tok), log.Printf("%+v", tok), and slog.Info("auth", "token", tok) all print the bearer token in full.

A developer who logs the token while debugging sends a live credential to their log system. Nothing warns them. Other SDK types already redact: generated types print [sealed], and encrypt.Secret redacts everywhere.

Proposal

  1. Add String, GoString, Format, and LogValue methods to auth.Token that redact AccessToken.
  2. Keep the other fields visible, such as ExpiresAt and Region, because they help debugging.
  3. Add a test that prints a token through fmt verbs and slog, and checks the token does not appear.

Evidence

Verified with go doc ./auth Token and a test program that printed a token through fmt and slog.

Metadata

Metadata

Assignees

Labels

GolangSDKbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions