Skip to content

Count a non-string active_roles entry as naming a role - #248

Merged
kahrendt merged 2 commits into
mainfrom
active-roles-unreadable-entry
Nov 4, 2026
Merged

kahrendt merged 2 commits into
mainfrom
active-roles-unreadable-entry

Conversation

@kahrendt

@kahrendt kahrendt commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

A follow-up from #244. messaging.md "server/activate" requires a client to close with client/goodbye reason 'unauthorized' when active_roles is non-empty on a connection that is not playback-capable. process_server_activate_message() skipped a non-string entry, so active_roles:[7] read as empty and such a connection was admitted where a strict client closes.

Change

  • active_roles: a non-string entry goes to 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'. A null entry reads the same way.
  • Siblings unchanged: activities and stream/end/stream/clear roles keep skipping such entries, since there one only narrows what the message applies to; a comment at the active_roles site 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, which Admissible.RolesRequirePlaybackCapability already covers both ways, so no admission test changes.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/protocol.cpp Resolved
Comment thread src/protocol.cpp Resolved
Comment thread tests/test_protocol.cpp Resolved
- 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.
@kahrendt
kahrendt merged commit d41e269 into main Nov 4, 2026
16 checks passed
@kahrendt
kahrendt deleted the active-roles-unreadable-entry branch November 4, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants