Skip to content

fix: correct protobuf wire type for ConfigHash and SecretKeyHashes#462

Merged
henderiw merged 1 commit into
sensitivefrom
fix/sensitive-config-protobuf-wire-types
Jun 30, 2026
Merged

fix: correct protobuf wire type for ConfigHash and SecretKeyHashes#462
henderiw merged 1 commit into
sensitivefrom
fix/sensitive-config-protobuf-wire-types

Conversation

@steiler

@steiler steiler commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ConfigHash (string) and SecretKeyHashes (map[string]string) in SensitiveConfigSpec were tagged with protobuf wire type varint
  • varint is only valid for integer scalars; string and map fields require wire type bytes
  • Any protobuf serialisation/deserialisation path (e.g. etcd storage in an aggregated API server) would produce garbled data or a runtime decode error
  • Fix: change both field tags from varint to bytes

Root cause

// before
ConfigHash      string            `... protobuf:"varint,5,opt,name=configHash"`
SecretKeyHashes map[string]string `... protobuf:"varint,6,opt,name=secretKeyHashes"`

// after
ConfigHash      string            `... protobuf:"bytes,5,opt,name=configHash"`
SecretKeyHashes map[string]string `... protobuf:"bytes,6,opt,name=secretKeyHashes"`

The other fields in the struct (Lifecycle, Payload, etc.) already use bytes correctly; these two were a copy-paste mistake from integer fields above them.

Test plan

  • Verify round-trip protobuf encode/decode of a SensitiveConfig with non-empty ConfigHash and SecretKeyHashes produces identical values
  • Confirm no existing etcd-stored objects are corrupted (field was newly introduced on the sensitive branch, so no migration needed)

Made with Cursor

ConfigHash (string) and SecretKeyHashes (map[string]string) were
tagged with protobuf wire type `varint`, which is only valid for
integer scalars.  The correct wire type for string and map fields
is `bytes`.

Using `varint` for these fields causes protobuf serialization and
deserialization (e.g. etcd storage in an aggregated API server) to
produce garbled data or return a decode error at runtime.

Change both tags from `varint` to `bytes` to match the Go types.

Co-authored-by: Cursor <cursoragent@cursor.com>
@steiler steiler requested a review from a team as a code owner June 30, 2026 08:44
@steiler steiler requested a review from henderiw June 30, 2026 08:45

@severindellsperger severindellsperger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@henderiw henderiw merged commit 0d97288 into sensitive Jun 30, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants