Repository navigation
Count a non-string active_roles entry as naming a role - #248
Merged
Merged
Conversation
messaging.md "server/activate" closes with 'unauthorized' when active_roles is non-empty on a connection that is not playback-capable. A non-string entry was skipped, so active_roles:[7] read as empty and was admitted there. It now names no role but makes the set non-empty, like a role version this library does not implement, so admission closes the connection. activities and stream/end's roles keep skipping such entries, which only narrow what the message applies to.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The comments mischaracterize the admission-validation gap caused by skipping non-string activities, and the ActiveRoles documentation no longer matches the new entry semantics.
3 open issues
What changed in this PR
Follows up on #244 by ensuring non-string active_roles entries cannot make a non-empty list appear empty during connection admission.
Changes:
- Count non-string entries as present without enabling any recognized role.
- Update parser comments and the
[7]test expectation.
| File | Description |
|---|---|
| tests/test_protocol.cpp | Expect [7] to produce a non-empty set with no role bits; update explanatory comments. |
| src/protocol.cpp | Pass every active_roles entry to ActiveRoles::add(), using an empty name for non-string values. |
Review effort: Max
- The active_roles comment says a skipped activities entry narrows the declared set, whose subsets are all allowed, rather than only what the message applies to. - ActiveRoles' add() and empty() docs describe entries, including an empty name for a non-string one. - The test comment names the null active_roles field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
A follow-up from #244. messaging.md "server/activate" requires a client to close with
client/goodbyereason'unauthorized'whenactive_rolesis non-empty on a connection that is not playback-capable.process_server_activate_message()skipped a non-string entry, soactive_roles:[7]read as empty and such a connection was admitted where a strict client closes.Change
ActiveRoles::add()as an empty name. It sets no role bit but makes the set non-empty, like a role version this library does not implement, so the existing admission check closes the connection with'unauthorized'. Anullentry reads the same way.activitiesandstream/end/stream/clearroleskeep skipping such entries, since there one only narrows what the message applies to; a comment at theactive_rolessite says why it differs.Tests
Protocol.ServerActivateReadsActiveRoles: the[7]row expects a non-empty set with mask 0; restoring the skip fails it. Admission takes only whether the set is empty, whichAdmissible.RolesRequirePlaybackCapabilityalready covers both ways, so no admission test changes.