Skip to content

fix: include user updates when revoking tokens - #228

Open
pcbeingused33 wants to merge 2 commits into
GetStream:masterfrom
pcbeingused33:fix/revoke-users-token-c2412
Open

pcbeingused33 wants to merge 2 commits into
GetStream:masterfrom
pcbeingused33:fix/revoke-users-token-c2412

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Nov 10, 2026 •

Copy link
Copy Markdown

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

revoke_users_token builds a partial update for each user with map, but discards the resulting array and passes an empty updates array to update_users_partial. As a result, both revoke_users_token and its single-user wrapper revoke_user_token send users: [], so no tokens are actually revoked.

Assign the mapped updates to updates so the PATCH request includes every requested user.

Testing

New offline spec spec/revoke_tokens_spec.rb (HTTP mocked, no API key needed) checks the PATCH payload for multiple users with a DateTime, one user with a string timestamp, and an empty list. On master the two non-empty cases fail because the payload is users: []; with the fix all three pass.

This change and its regression tests were prepared with OpenAI Codex.


Note

Medium Risk
Restores security-sensitive token revocation behavior; scope is a small payload fix with new regression specs.

Overview
revoke_users_token previously built per-user partial updates with map but never stored the result, so update_users_partial always received users: [] and no tokens were revoked (including via revoke_user_token).

The fix assigns updates = user_ids.map { ... } so each user is PATCHed with revoke_tokens_issued_before after timestamp normalization.

Adds spec/revoke_tokens_spec.rb with mocked HTTP expectations for multi-user (DateTime), single-user (string timestamp), and empty user list payloads.

Reviewed by Cursor Bugbot for commit 78ae4c9. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 78ae4c9. Configure here.

describe StreamChat::Client do
let(:client) { described_class.new('test-key', 'test-secret') }
let(:timestamp) { '2026-11-10T00:00:00+00:00' }
let(:response) { StreamChat::StreamResponse.new({}, Faraday::Response.new(status: 200, response_headers: {})) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test stub builds Faraday response incorrectly

Medium Severity

The response helper passes status and response_headers as keywords to Faraday::Response.new, but that initializer only takes an optional env. On Ruby 3 this raises ArgumentError when the lazy helper is first used, so every example errors during setup and never asserts the PATCH payload.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 78ae4c9. Configure here.

@pcbeingused33

Copy link
Copy Markdown
Author

Friendly ping: could someone take a look at this when there's time? I'm happy to adjust anything. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant