mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 17:41:22 +00:00
fix (security/line): fail closed when webhook auth is missing
This commit is contained in:
@@ -129,6 +129,15 @@ export async function monitorLineProvider(
|
||||
webhookPath,
|
||||
} = opts;
|
||||
const resolvedAccountId = accountId ?? "default";
|
||||
const token = channelAccessToken.trim();
|
||||
const secret = channelSecret.trim();
|
||||
|
||||
if (!token) {
|
||||
throw new Error("LINE webhook mode requires a non-empty channel access token.");
|
||||
}
|
||||
if (!secret) {
|
||||
throw new Error("LINE webhook mode requires a non-empty channel secret.");
|
||||
}
|
||||
|
||||
// Record starting state
|
||||
recordChannelRuntimeState({
|
||||
@@ -142,8 +151,8 @@ export async function monitorLineProvider(
|
||||
|
||||
// Create the bot
|
||||
const bot = createLineBot({
|
||||
channelAccessToken,
|
||||
channelSecret,
|
||||
channelAccessToken: token,
|
||||
channelSecret: secret,
|
||||
accountId,
|
||||
runtime,
|
||||
config,
|
||||
@@ -281,7 +290,7 @@ export async function monitorLineProvider(
|
||||
pluginId: "line",
|
||||
accountId: resolvedAccountId,
|
||||
log: (msg) => logVerbose(msg),
|
||||
handler: createLineNodeWebhookHandler({ channelSecret, bot, runtime }),
|
||||
handler: createLineNodeWebhookHandler({ channelSecret: secret, bot, runtime }),
|
||||
});
|
||||
|
||||
logVerbose(`line: registered webhook handler at ${normalizedPath}`);
|
||||
|
||||
Reference in New Issue
Block a user