Harden Slack allow-from resolution against undefined catch crash#21967
Merged
Takhoffman merged 3 commits intoopenclaw:mainfrom Mar 1, 2026
Merged
Conversation
741590e to
0676479
Compare
Contributor
1 task
ansh
pushed a commit
to vibecode/openclaw
that referenced
this pull request
Mar 2, 2026
steipete
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Mar 2, 2026
safzanpirani
pushed a commit
to safzanpirani/clawdbot
that referenced
this pull request
Mar 2, 2026
steipete
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Mar 2, 2026
amitmiran137
pushed a commit
to amitmiran137/openclaw
that referenced
this pull request
Mar 2, 2026
hanqizheng
pushed a commit
to hanqizheng/openclaw
that referenced
this pull request
Mar 2, 2026
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Mar 2, 2026
dorgonman
pushed a commit
to kanohorizonia/openclaw
that referenced
this pull request
Mar 3, 2026
sachinkundu
pushed a commit
to sachinkundu/openclaw
that referenced
this pull request
Mar 6, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 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.
Harden Slack allow-from resolution against undefined catch crash
Closes #19799
Summary
This patch hardens Slack allowlist resolution so malformed or non-promise pairing-store responses cannot crash
prepareSlackMessage. It replaces chained.catch()usage with defensivetry/catch+ array validation and adds regression tests that cover throw and malformed return paths.Problem
resolveSlackEffectiveAllowFromshould gracefully fall back to empty store entries when pairing-store reads fail or return invalid data..catch()directly on the read result; if the mocked/runtime value isundefined, it throwsTypeError: Cannot read properties of undefined (reading 'catch').Reproduction
prepareSlackMessagein a test/runtime path wherereadChannelAllowFromStore("slack")returnsundefinedor a non-promise value.resolveSlackEffectiveAllowFromduring message preparation..catchagainstundefined.Issues Found
Severity: high
Confidence: high
Status: fixed
src/slack/monitor/auth.tssrc/slack/monitor/auth.ts:6Fix Approach
.catch()withtry/catcharound awaited store read.Array.isArray; treat invalid values as empty.Testing
pnpm test src/slack/monitor/auth.test.ts src/slack/monitor/message-handler/prepare.test.ts(pass)pnpm lint(pass)pnpm tsgo(pass)Risk / Notes
Greptile Summary
Replaces fragile promise chaining with defensive
try/catchblock in Slack allowlist resolution. Previously, whenreadChannelAllowFromStore("slack")returnedundefinedor other non-promise values, calling.catch()directly would throwTypeError: Cannot read properties of undefined (reading 'catch'). The fix wraps the store read intry/catch, validates the result withArray.isArray, and safely defaults to empty array on error or malformed data.Changes:
await readChannelAllowFromStore("slack").catch(() => [])with explicittry/catch+ array validation insrc/slack/monitor/auth.ts:5-12src/slack/monitor/auth.test.ts:23-30undefinedreturn value scenario insrc/slack/monitor/auth.test.ts:32-39The fix properly addresses the root cause: the code assumed
readChannelAllowFromStorealways returns a promise, but mocks or edge cases can return non-promise values, causing the.catch()call to fail.Confidence Score: 5/5
Last reviewed commit: f79fc82