omi icon indicating copy to clipboard operation
omi copied to clipboard

Slack plugin: unresolved channel searches silently fall back to the whole workspace

Open kaijakagi-sys opened this issue 2 months ago • 0 comments

In the standalone Slack plugin at 9ff63a6, an explicit channel constraint can disappear when the channel name cannot be resolved.

SlackClient.search_messages starts with search_query = query and adds in:<channel_id> only after successful name resolution. If resolution finds no match, it still calls Slack search with the bare query. list_channels also turns SDK errors into [], so a failed lookup can take the same path. The /api/search_messages handler then formats the returned matches as a successful result.

I reproduced this offline by executing the unchanged production handler plus list_channels and search_messages, with SDK, storage and HTTP-response stubs:

Requested channel Channel lookup Query passed to Slack search
#missing Successful, no matching channel budget
#general SDK error ratelimited budget
#general Resolves to C123 in:C123 budget
C123 ID supplied in:C123 budget
Omitted Successful budget

Both failure cases return HTTP 200 and format the stub's unrelated-channel match as a found message. This is a search-scope correctness issue: results can come from other channels accessible to the same Slack account. I am not claiming access beyond that account's Slack permissions or a live-workspace reproduction.

Proposed scope:

  • Preserve explicit channel intent; return a useful channel-resolution or lookup error instead of silently widening the search.
  • Distinguish an empty successful listing from a failed listing at the search boundary, without breaking other list-channel callers.
  • Keep intentional workspace-wide searches working when no channel is supplied, and preserve resolved-name/direct-ID behavior.
  • Add hermetic handler/client regressions asserting that unresolved channels and lookup failures never trigger unscoped search, with valid-name, direct-ID and omitted-channel controls.

Five offline behavior checks completed; no live Slack calls, implemented fix or repository-preflight claim. OAuth, sending messages, history pagination and the separate backend integrations are out of scope.

Is this standalone plugin still supported, and would you accept this focused fix as a paid bounty? @josancamon19, following the contribution guide's bounty-suggestion process, please confirm the cash reward and acceptance criteria before implementation. This is a bounty request, not an approved award.

kaijakagi-sys avatar Sep 08 '26 16:09 kaijakagi-sys