fix(slack): apply open policy consistently to slash commands
Address reviewer feedback: slash commands now use the same hasExplicitConfig check as regular messages, so unlisted channels are allowed under groupPolicy: "open" for both message handling and slash commands.
This commit is contained in:
committed by
Peter Steinberger
parent
72d62a54c6
commit
4d2e9e8113
@@ -262,8 +262,7 @@ export function registerSlackMonitorSlashCommands(params: {
|
|||||||
groupPolicy: ctx.groupPolicy,
|
groupPolicy: ctx.groupPolicy,
|
||||||
channelAllowlistConfigured,
|
channelAllowlistConfigured,
|
||||||
channelAllowed,
|
channelAllowed,
|
||||||
}) ||
|
})
|
||||||
!channelAllowed
|
|
||||||
) {
|
) {
|
||||||
await respond({
|
await respond({
|
||||||
text: "This channel is not allowed.",
|
text: "This channel is not allowed.",
|
||||||
@@ -271,13 +270,17 @@ export function registerSlackMonitorSlashCommands(params: {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
// When groupPolicy is "open", only block channels that are EXPLICITLY denied
|
||||||
if (ctx.useAccessGroups && channelConfig?.allowed === false) {
|
// (i.e., have a matching config entry with allow:false). Channels not in the
|
||||||
await respond({
|
// config (matchSource undefined) should be allowed under open policy.
|
||||||
text: "This channel is not allowed.",
|
const hasExplicitConfig = Boolean(channelConfig?.matchSource);
|
||||||
response_type: "ephemeral",
|
if (!channelAllowed && (ctx.groupPolicy !== "open" || hasExplicitConfig)) {
|
||||||
});
|
await respond({
|
||||||
return;
|
text: "This channel is not allowed.",
|
||||||
|
response_type: "ephemeral",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user