Skip to content

Go SDK: CreateUser omits mandatory permissions_len field when permissions are nil #2981

@atharvalade

Description

@atharvalade

The Rust wire format for CreateUser always includes permissions_len:u32_le on the wire, even when has_permissions=0. The server-side decoder unconditionally reads these 4 bytes (see create_user.rs#L82-L83), and the Rust encoder always writes them (see create_user.rs#L61-L62).

In the Go SDK (foreign/go/internal/command/user.go), the nil-permissions branch only writes has_permissions=0 (1 byte) and skips the 4-byte permissions_len=0:

} else {
    bytes[position] = byte(0) // writes flag only, no permissions_len
}

The server will try to read 4 bytes that aren't there, causing a parse failure or reading into the next message.

Fix: Write permissions_len=0 (4 zero bytes) after the flag in the else branch, and add 4 to the base capacity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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