Skip to content

Commit 6a11c40

Browse files
committed
fix(bug): passes cap limit set. passes text area bug fixed
1 parent 441af4b commit 6a11c40

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export const TEST_TIMEOUT_MS = Number(process.env.TEST_TIMEOUT_MS || 5 * 60 * 10
5454
// pre-loads — and by default auto-runs — a matrix without going through the UI.
5555
export const MATRIX_CONFIG = process.env.MATRIX_CONFIG || '';
5656
export const MATRIX_MAX_ENTRIES = Number(process.env.MATRIX_MAX_ENTRIES || 24);
57+
// Cap on the number of passes per matrix submission. Each pass pre-creates
58+
// combos × History records and queues a full sequential matrix run, so an
59+
// unbounded passes array is an easy DoS vector. Override with MATRIX_MAX_PASSES.
60+
export const MATRIX_MAX_PASSES = Number(process.env.MATRIX_MAX_PASSES || 10);
5761
export const AGENT_TIMEOUT_MS = Number(process.env.AGENT_TIMEOUT_MS || 25 * 60 * 1000);
5862
// How long to wait for the (headless) post-edit dev-server build before giving up
5963
// and screenshotting anyway. Generous because the first build of an agent-edited

src/matrix/request.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
import { MATRIX_MAX_ENTRIES, PROMPT_IMAGES_DIR, PROMPT_IMAGE_MAX_COUNT } from '../config.ts';
3+
import { MATRIX_MAX_ENTRIES, MATRIX_MAX_PASSES, PROMPT_IMAGES_DIR, PROMPT_IMAGE_MAX_COUNT } from '../config.ts';
44
import { getFramework } from '../provider-registry.ts';
55
import { resolveSelection } from '../prompt-images.ts';
66
import { parseVariants, variantLabel } from './variants.ts';
@@ -58,6 +58,10 @@ export function normalizeMatrixRequest(raw: any): MatrixRequestResult {
5858
}
5959
const prompt = passes[0].prompt; // back-compat alias
6060
const name = passes[0].name ?? null; // back-compat alias
61+
if (passes.length > MATRIX_MAX_PASSES) {
62+
return { ok: false, error: `passes capped at ${MATRIX_MAX_PASSES}; reduce the number of passes` };
63+
}
64+
6165
if (!platforms.length || !variants.length) {
6266
return { ok: false, error: 'select at least one platform and one variant' };
6367
}

web/matrix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ async function onSubmit(e: Event) {
503503

504504
const extraPassSection = () => html`
505505
${st.extraPasses.length ? html`<div class="mx-passes-stack">
506-
${st.extraPasses.map((pass, i) => {
506+
${repeat(st.extraPasses, (p) => p.key, (pass, i) => {
507507
const num = i + 2;
508508
return html`
509509
<div class="mx-extra-pass">

0 commit comments

Comments
 (0)