Fix Bus.unsubscribe splice(-1) bug and copilot-stream auth validation#504
Open
fuleinist wants to merge 1 commit intorowboatlabs:mainfrom
Open
Fix Bus.unsubscribe splice(-1) bug and copilot-stream auth validation#504fuleinist wants to merge 1 commit intorowboatlabs:mainfrom
fuleinist wants to merge 1 commit intorowboatlabs:mainfrom
Conversation
…-stream endpoint Fixes two security issues: 1. CLI Bus.unsubscribe (issue rowboatlabs#492): Fix splice(-1,1) bug when indexOf returns -1. - When unsubscribe is called twice, splice(-1,1) removes the last element instead of doing nothing. - Guard with indexOf check before splicing. 2. Copilot stream auth validation (issue rowboatlabs#493/rowboatlabs#494): Return 401 when Bearer token is missing. - Extract and validate apiKey before passing to controller. - Prevents undefined apiKey from bypassing auth checks.
This was referenced Apr 16, 2026
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
Fixes two security/auth bugs reported in issues #493 and #494:
Issue #492: CLI Bus.unsubscribe splice(-1) bug
Problem: without guarding against returning . Double-unsubscribe removes the wrong handler (last element via ).
Fix: Added index guard before splice in both and .
Issues #493/#494: Missing auth validation on copilot-stream-response endpoint
Problem: passes apiKey when Bearer token is missing, allowing requests to bypass auth.
Fix: Added 401 response when token is missing/empty in .
Testing
Both bugs are verifiable by replaying the reproduction steps in issues #492 and #493.