Skip to content

[Bug]: !!binary YAML tag fails with "Incorrect padding" on Salt 3008 (Python 3.14) #69207

@twangboy

Description

@twangboy

What happened?

Using the !!binary YAML tag in a state file fails to render on Salt 3008 with a base64 padding error. The same state worked correctly on Salt 3006.

State Example:

test:
  reg.present:
    - name: HKLM\SOFTWARE\TestKey
    - vname: ItemData
    - vtype: REG_BINARY
    - vdata: !!binary a1b2c3

Error:

Rendering SLS 'base:test' failed: failed to decode base64 data: Incorrect padding in "<unicode string>", line 6, column 14

Root Cause:

Salt's SaltYamlSafeLoader inherits construct_yaml_binary from PyYAML, which calls base64.decodebytes() to decode !!binary values. The value a1b2c3 is 6 characters — not a multiple of 4 — so it is missing == padding to be valid standard base64. Python 3.14 (bundled with Salt 3008 onedir) is stricter about this than Python 3.10 (bundled with Salt 3006), causing binascii.Error: Incorrect padding to be raised during SLS rendering.

Expected Behavior:

Salt should tolerate !!binary values with missing base64 padding (a common occurrence when users hand-write base64 strings), consistent with behavior in Salt 3006.

Type of salt install

Official exe

Major version

3007.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

almalinux-8

salt --versions-report output

This was discovered testing 3008.0rc4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions