@@ -103,10 +103,20 @@ type SlackInteractiveDispatchContext = Omit<
103103export async function dispatchSlackPluginInteractiveHandler ( params : {
104104 data : string ;
105105 interactionId : string ;
106+ channelType ?: "im" | "mpim" | "channel" | "group" ;
106107 ctx : SlackInteractiveDispatchContext ;
107108 respond : SlackInteractiveHandlerContext [ "respond" ] ;
108109 onMatched ?: ( ) => Promise < void > | void ;
109110} ) {
111+ const senderId = params . ctx . senderId ?. trim ( ) ;
112+ const baseConversationId =
113+ params . channelType === "im"
114+ ? senderId
115+ ? `user:${ senderId } `
116+ : ""
117+ : params . ctx . conversationId . trim ( ) ;
118+ const threadId = params . ctx . threadId ?. trim ( ) || undefined ;
119+
110120 return await dispatchPluginInteractiveHandler < SlackInteractiveHandlerRegistration > ( {
111121 channel : "slack" ,
112122 data : params . data ,
@@ -124,14 +134,20 @@ export async function dispatchSlackPluginInteractiveHandler(params: {
124134 } ,
125135 respond : params . respond ,
126136 ...createInteractiveConversationBindingHelpers ( {
127- registration,
137+ // The shared helpers fail closed without owner authority; never expose it to unauthenticated actions.
138+ registration :
139+ params . ctx . auth . isAuthorizedSender && baseConversationId
140+ ? registration
141+ : { ...registration , pluginRoot : undefined } ,
128142 senderId : params . ctx . senderId ,
129143 conversation : {
130144 channel : "slack" ,
131145 accountId : params . ctx . accountId ,
132- conversationId : params . ctx . conversationId ,
133- parentConversationId : params . ctx . parentConversationId ,
134- threadId : params . ctx . threadId ,
146+ conversationId : threadId ?? baseConversationId ,
147+ parentConversationId : threadId
148+ ? ( params . ctx . parentConversationId ?? baseConversationId )
149+ : params . ctx . parentConversationId ,
150+ threadId,
135151 } ,
136152 } ) ,
137153 } ) ,
0 commit comments