




















@@ -190,6 +190,36 @@ describe("gateway restart handoff", () => {
190190expect(fs.existsSync(handoffPath(env))).toBe(false);
191191});
192192193+it("rejects persisted handoffs with a ttl longer than the supported window", () => {
194+const env = createHandoffEnv();
195+196+fs.writeFileSync(
197+handoffPath(env),
198+`${JSON.stringify({
199+ kind: GATEWAY_SUPERVISOR_RESTART_HANDOFF_KIND,
200+ version: 1,
201+ intentId: "too-long",
202+ pid: 111,
203+ createdAt: 1_000,
204+ expiresAt: 61_001,
205+ source: "plugin-change",
206+ restartKind: "full-process",
207+ supervisorMode: "external",
208+ })}\n`,
209+{ encoding: "utf8", mode: 0o600 },
210+);
211+212+expect(readGatewayRestartHandoffSync(env, 1_001)).toBeNull();
213+expect(
214+consumeGatewayRestartHandoffForExitedProcessSync({
215+ env,
216+exitedPid: 111,
217+now: 1_001,
218+}),
219+).toBeNull();
220+expect(fs.existsSync(handoffPath(env))).toBe(false);
221+});
222+193223it("does not follow an existing handoff-path symlink when writing", () => {
194224const env = createHandoffEnv();
195225const targetPath = path.join(env.OPENCLAW_STATE_DIR ?? "", "attacker-target.txt");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。