Skip to content

CEL validation of format: byte CRD fields fails on standard base64 #633

Closed

Description

@joelanford

I have a CRD with a format: byte field and a CEL transition rule that compares it (self.data == oldSelf.data). Updating the resource, even with identical data, fails:

Invalid byte formatted string H4sIAAAAAAAA/0TL...: illegal base64 data at input byte 12

The value is valid standard base64 (RFC 4648 section 4). The / at byte 12 is legal. Creation works fine because transition rules aren't evaluated without oldSelf.

The problem is in strfmt.Base64.UnmarshalText, which the CEL value converter calls when evaluating rules on format: byte fields. UnmarshalText decodes with base64.URLEncoding (expects - and _), but Go's encoding/json serializes []byte fields with base64.StdEncoding (produces + and /). Any value containing either character is rejected.

The strfmt.Base64 type is also internally inconsistent: UnmarshalText/MarshalText use URLEncoding, while UnmarshalJSON/MarshalJSON/String() use StdEncoding. This was already fixed upstream in go-openapi/strfmt#283 but the vendored copy in kube-openapi still carries the old behavior.

Related: go-openapi/strfmt#87

Activity

  1. added a commit that references this issue on Aug 21, 2026
    40dab54
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions