mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 15:54:32 +00:00
test: dedupe repeated validation and throw assertions
This commit is contained in:
@@ -21,10 +21,10 @@ import type { SessionEntry } from "./types.js";
|
||||
|
||||
describe("session path safety", () => {
|
||||
it("rejects unsafe session IDs", () => {
|
||||
expect(() => validateSessionId("../etc/passwd")).toThrow(/Invalid session ID/);
|
||||
expect(() => validateSessionId("a/b")).toThrow(/Invalid session ID/);
|
||||
expect(() => validateSessionId("a\\b")).toThrow(/Invalid session ID/);
|
||||
expect(() => validateSessionId("/abs")).toThrow(/Invalid session ID/);
|
||||
const unsafeSessionIds = ["../etc/passwd", "a/b", "a\\b", "/abs"];
|
||||
for (const sessionId of unsafeSessionIds) {
|
||||
expect(() => validateSessionId(sessionId), sessionId).toThrow(/Invalid session ID/);
|
||||
}
|
||||
});
|
||||
|
||||
it("resolves transcript path inside an explicit sessions dir", () => {
|
||||
|
||||
Reference in New Issue
Block a user