jcmturner / gokrb5

Pure Go Kerberos library for clients and services
Apache License 2.0
723 stars 245 forks source link

Principal Name Formatting in Errors #442

Closed bflad closed 2 years ago

bflad commented 3 years ago

Version

github.com/jcmturner/gokrb5/v8 v8.4.1

Description

Hello 👋 There is possibility for minor confusion when certain error messages are printed, for example:

matching key not found in keytab. Looking for [HTTP svc_prd_tf_ad.example.com] realm: EXAMPLE.COM kvno: 0 etype: 18

The underlying formatting code is converting the principal name (stored as []string type) using the %v format verb, which gives the unexpected bracket and spaced output. Consumers may incorrectly guess that implementation code prior to this call with the error message have done this conversion, especially if they are unfamiliar with Go and string formatting.

References