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

   ### Bug description
   
   The Node.js SDK cannot create users or update permissions when 
`permissions.streams` is non-empty.
   
   The permission wire format requires a continuation marker after every topic 
and stream entry. The Node serializer omits both `has_next_topic` and 
`has_next_stream`, so a single stream without topics produces a 22-byte 
permission payload while the server expects a final stream marker at byte 23. 
The Rust decoder returns `UnexpectedEof { offset: 22, need: 1, have: 0 }`, 
which is surfaced to the client as `Invalid command`.
   
   The receive path has the matching cursor bug: it reads topic and stream 
continuation markers without advancing past them. Permission responses 
containing multiple topics or streams can therefore be truncated, misaligned, 
or throw while decoding.
   
   Expected behavior: `createUser`, `updatePermissions`, and `getUser` should 
round-trip global, stream, and topic permissions using the canonical wire 
format.
   
   ### Affected area / component
   
   - Node.js SDK
   - Wire protocol / API
   
   ### Deployment
   
   Not applicable
   
   ### Versions
   
   Current `master` at `6f68d921`; Node.js SDK package version `0.8.1-edge.1`.
   
   ### Hardware / environment
   
   Not applicable
   
   ### Sample code
   
   Any `createUser` or `updatePermissions` call with at least one scoped stream 
reproduces the failure:
   
   ```ts
   await client.user.updatePermissions({
     userId,
     permissions: {
       global,
       streams: [{
         streamId: 1,
         permissions: streamPermissions,
         topics: []
       }]
     }
   });
   ```
   
   ### Logs
   
   ```text
   UnexpectedEof { offset: 22, need: 1, have: 0 }
   Invalid command
   ```
   
   ### Reproduction
   
   1. Start an Iggy server from current `master`.
   2. Connect using the Node.js SDK.
   3. Create a user or update an existing user with `permissions.streams` 
containing one stream.
   4. Observe that the command is rejected as `Invalid command`.
   5. Fetch a user whose permissions contain multiple streams or topics and 
observe incomplete or misaligned decoded entries.
   
   ### Contribution
   
   - [x] I'm willing to submit a pull request to fix this bug
   


-- 
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