Skip to content

ClientSetInfo adds runtime.Version() to libName #2914

Closed
@Woutifier

Description

@Woutifier

ClientSetInfo adds the output of runtime.Version() to the libName. The runtime.Version() is not guaranteed to not contain characters not allowed by redis. For example in our case it is: go1.22.0 X:boringcrypto, and spaces are not allowed in libName.

The only way to prevent this is to set DisableIndentity (presumably a typo from DisableIdentity). However, if you are also using Sentinel then that option is not copied over in sentinelOptions so you'll always send the illegal libName.

sentinel.go:552: sentinel: GetMasterAddrByName master="default" failed: ERR LIB-NAME cannot contain spaces, newlines or special characters.
libName = go-redis(,go1.22.0 X:boringcrypto)

Expected Behavior

It shouldn't matter what the go version string is when connecting to a redis server.

DisableIndentity should prevent it from being sent in all cases

Current Behavior

It matters what the go version string is, potentially breaking when that string is illegal in libName

DisableIndentity does not always prevent libName from being sent (e.g. Sentinel).

Possible Solution

Remove the Go version from the libName, or strip illegal characters from it. Also copy disableIndentity in all relevant places.

Steps to Reproduce

Build a redis client program using a Go version that has a version string with a space in it

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