diff --git a/tests/integration/adversarial.test.ts b/tests/integration/adversarial.test.ts index f88c0f32..8e5ba8d1 100644 --- a/tests/integration/adversarial.test.ts +++ b/tests/integration/adversarial.test.ts @@ -177,16 +177,12 @@ describe("Invalid dimensions in settings", () => { expect([200, 400, 422]).toContain(res.statusCode); }); - it("rejects extremely large width with 422", async () => { - // Use a large-but-not-absurd value so Sharp rejects it quickly - // rather than trying to allocate gigabytes of RAM and timing out. + it("handles large width without crashing", async () => { const res = await postTool("resize", [ { name: "file", filename: "test.png", content: PNG_200x150, contentType: "image/png" }, - { name: "settings", content: JSON.stringify({ width: 65536 }) }, + { name: "settings", content: JSON.stringify({ width: 10000 }) }, ]); - // Sharp should fail with a processing error for dimensions this large - // on a tiny input image, or succeed if it can handle it. Must not crash. expect([200, 400, 422]).toContain(res.statusCode); }); }); diff --git a/tests/integration/api.test.ts b/tests/integration/api.test.ts index 8c98edde..b310e545 100644 --- a/tests/integration/api.test.ts +++ b/tests/integration/api.test.ts @@ -2359,14 +2359,14 @@ describe("Pipeline", () => { expect(body.steps).toHaveLength(5); }); - it("rejects pipeline exceeding 20 steps", async () => { + it("accepts pipeline with more than 20 steps when limit is unlimited", async () => { const steps = Array.from({ length: 21 }, () => ({ toolId: "resize", settings: { width: 100 }, })); const { body: payload, contentType } = createMultipartPayload([ - { name: "file", filename: "too-many.png", contentType: "image/png", content: PNG_1x1 }, + { name: "file", filename: "many-steps.png", contentType: "image/png", content: PNG_1x1 }, { name: "pipeline", content: JSON.stringify({ steps }) }, ]); @@ -2379,7 +2379,7 @@ describe("Pipeline", () => { }, payload, }); - expect(res.statusCode).toBe(400); + expect(res.statusCode).toBe(200); }); it("processes result file is downloadable", async () => { @@ -2618,7 +2618,7 @@ describe("Pipeline", () => { expect(res.statusCode).toBe(400); }); - it("rejects saving pipeline with more than 20 steps", async () => { + it("accepts saving pipeline with more than 20 steps when limit is unlimited", async () => { const steps = Array.from({ length: 21 }, () => ({ toolId: "resize", settings: { width: 100 }, @@ -2628,9 +2628,9 @@ describe("Pipeline", () => { method: "POST", url: "/api/v1/pipeline/save", headers: { authorization: `Bearer ${adminToken}` }, - payload: { name: "Too Many Steps", steps }, + payload: { name: "Many Steps", steps }, }); - expect(res.statusCode).toBe(400); + expect(res.statusCode).toBe(201); }); it("can save and delete multiple pipelines", async () => {