File tree Expand file tree Collapse file tree
apps/sim/app/api/tools/slack/channels Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,11 +31,20 @@ interface SlackChannel {
3131 * `is_member` filter — no regression.
3232 */
3333const SCOPED_USER_ID_PATTERN =
34- / - u s r _ ( [ U W B ] [ A - Z 0 - 9 ] + ) - [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } $ / i
34+ / - u s r _ ( [ U W ] [ A - Z 0 - 9 ] + ) - [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } $ / i
3535
3636function parseScopedSlackUserId ( accountId : string ) : string | null {
3737 const match = SCOPED_USER_ID_PATTERN . exec ( accountId )
38- return match ? match [ 1 ] : null
38+ if ( match ) return match [ 1 ]
39+ // A marker is present but the id didn't parse — surface it instead of
40+ // silently dropping to the bot `is_member` filter, which would bypass the
41+ // installer-scoped privacy check without any signal.
42+ if ( accountId . includes ( '-usr_' ) ) {
43+ logger . warn ( 'Slack accountId carries usr_ marker but did not parse; using is_member fallback' , {
44+ accountId,
45+ } )
46+ }
47+ return null
3948}
4049
4150export const POST = withRouteHandler ( async ( request : NextRequest ) => {
You can’t perform that action at this time.
0 commit comments