refactor(security): harden CommandAuthorized plumbing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { resolveAckReaction } from "../../../agents/identity.js";
|
||||
import { hasControlCommand } from "../../../auto-reply/command-detection.js";
|
||||
import { shouldHandleTextCommands } from "../../../auto-reply/commands-registry.js";
|
||||
import type { FinalizedMsgContext } from "../../../auto-reply/templating.js";
|
||||
import {
|
||||
formatInboundEnvelope,
|
||||
formatThreadStarterEnvelope,
|
||||
@@ -466,10 +467,10 @@ export async function prepareSlackMessage(params: {
|
||||
MediaPath: media?.path,
|
||||
MediaType: media?.contentType,
|
||||
MediaUrl: media?.path,
|
||||
CommandAuthorized: commandAuthorized,
|
||||
OriginatingChannel: "slack" as const,
|
||||
OriginatingTo: slackTo,
|
||||
}) satisfies Record<string, unknown>;
|
||||
CommandAuthorized: commandAuthorized,
|
||||
OriginatingChannel: "slack" as const,
|
||||
OriginatingTo: slackTo,
|
||||
}) satisfies FinalizedMsgContext;
|
||||
|
||||
const replyTarget = ctxPayload.To ?? undefined;
|
||||
if (!replyTarget) return null;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ResolvedAgentRoute } from "../../../routing/resolve-route.js";
|
||||
import type { FinalizedMsgContext } from "../../../auto-reply/templating.js";
|
||||
import type { ResolvedSlackAccount } from "../../accounts.js";
|
||||
import type { SlackMessageEvent } from "../../types.js";
|
||||
import type { SlackChannelConfigResolved } from "../channel-config.js";
|
||||
@@ -11,7 +12,7 @@ export type PreparedSlackMessage = {
|
||||
route: ResolvedAgentRoute;
|
||||
channelConfig: SlackChannelConfigResolved | null;
|
||||
replyTarget: string;
|
||||
ctxPayload: Record<string, unknown>;
|
||||
ctxPayload: FinalizedMsgContext;
|
||||
isDirectMessage: boolean;
|
||||
isRoomish: boolean;
|
||||
historyKey: string;
|
||||
|
||||
Reference in New Issue
Block a user