fix(hub): re-evaluate can_write on channel reattach - #157
Merged
Conversation
jamofer
force-pushed
the
fix/hub3-recheck-can-write-on-reattach
branch
from
July 21, 2026 22:20
bcd1310 to
8694b41
Compare
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.
What
Re-resolve the client write permission when a channel is reattached after an agent reconnect, instead of reusing the value stored at OPEN.
Why
Audit HUB-3 (HIGH), an ACL bypass introduced by the #149 reattach path.
reattachClientsToAgentre-checkedcan_readbut nevercan_write. So: client OPENs with a write grant → admin revokes write → agent flaps and re-registers → the channel reattaches with the stalecan_write=true→ the client keeps injecting frames. The AuthorizationPort revocation was silently defeated.How
can_write(viaclientCanWrite) intoClientSession_ReattachInterface, assigning it onto the binding alongsideinterface_id/dormant— the reattach mutation stays atomic.broker.ccomputes it at the reattach site wherepeer/entryare already in scope.Testing
make testgreen (385/385, +1)test_broker.cpp"client write authorization": grant write → OPEN → revoke write → agent flap → injected frame is dropped. Verified it fails without the fix.Notes
Write-direction only (the security-critical stale-allow). Read is already re-checked on reattach. No wire-format impact.