p4rtridge opened a new issue, #4749:
URL: https://github.com/apache/iggy/issues/4749

   ### Bug description
   
   ### Bug description
   
   In `foreign/go/internal/command/access_token.go`, the Go SDK does not 
validate personal access token name lengths in `CreatePersonalAccessToken` or 
`DeletePersonalAccessToken`.
   
   The server’s WireName type requires names to contain 1–255 bytes, as defined 
in 
[core/binary_protocol/src/primitives/identifier.rs](https://github.com/apache/iggy/blob/master/core/binary_protocol/src/primitives/identifier.rs).
   
   Both Go commands serialize invalid names without returning an error:
   
   - Empty names produce a zero length prefix, which the server rejects.
   - Names longer than 255 bytes cause `byte(len(c.Name))` to wrap while the 
full name is still written. For example, a 256-byte name produces a zero length 
prefix, which the server rejects.
   
   
   ### Reproduction
   
   Call `MarshalBinary()` on either command with:
   
   - Name: ""
   - Name: strings.Repeat("t", 256)
   
   Both return a request body without an error, but the server rejects these 
requests.
   
   
   ### Proposed solution
   
   Validate the name’s byte length before serialization in both commands and 
return an error when it falls outside the 1–255 range. Follow the existing 
name-length validation pattern in 
`foreign/go/internal/command/update_resource.go`.
   
   
   ### Related pull request
   
   Follow-up to the review of [#4640](https://github.com/apache/iggy/pull/4640).
   
   ### Affected area / component
   
   Go SDK
   
   ### Deployment
   
   _No response_
   
   ### Versions
   
   _No response_
   
   ### Hardware / environment
   
   _No response_
   
   ### Sample code
   
   _No response_
   
   ### Logs
   
   _No response_
   
   ### Iggy server config
   
   _No response_
   
   ### Reproduction
   
   _No response_
   
   ### Contribution
   
   - [x] I'm willing to submit a pull request to fix this bug
   
   ### Good first issue
   
   - [x] I think this could be a good first issue for a new contributor


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to