Gateway: harden cron.runs jobId path handling (openclaw#24038) thanks @Takhoffman

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Takhoffman <781889+Takhoffman@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Tak Hoffman
2026-02-22 19:35:26 -06:00
committed by GitHub
parent 45febecf2a
commit 259d863353
6 changed files with 79 additions and 6 deletions

View File

@@ -214,10 +214,20 @@ export const cronHandlers: GatewayRequestHandlers = {
);
return;
}
const logPath = resolveCronRunLogPath({
storePath: context.cronStorePath,
jobId,
});
let logPath: string;
try {
logPath = resolveCronRunLogPath({
storePath: context.cronStorePath,
jobId,
});
} catch {
respond(
false,
undefined,
errorShape(ErrorCodes.INVALID_REQUEST, "invalid cron.runs params: invalid id"),
);
return;
}
const entries = await readCronRunLogEntries(logPath, {
limit: p.limit,
jobId,