OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
fix(action): describe positive numeric input bounds (#1605)
wjf61dfd9fe717
diff --git a/github-action/dist/index.cjs b/github-action/dist/index.cjsindex 2494315f4..ad63fee6c 100644--- a/github-action/dist/index.cjs+++ b/github-action/dist/index.cjs@@ -55565,8 +55565,10 @@ function parseInputs(read, workspace) {const value = str(name);if (!value) return void 0;const n = Number(value);- if (!Number.isFinite(n) || integer && !Number.isSafeInteger(n) || n < min || n > max)- throw new Error(`${name} must be ${integer ? "an integer" : "a number"} between ${min} and ${max}.`);+ if (!Number.isFinite(n) || integer && !Number.isSafeInteger(n) || n < min || n > max) {+ const bounds = min === Number.MIN_VALUE ? `a positive number${max < Infinity ? ` no greater than ${max}` : ""}` : `${integer ? "an integer" : "a number"} between ${min} and ${max}`;+ throw new Error(`${name} must be ${bounds}.`);+ }return n;};const list = (name) => str(name).split(/\r?\n/).map((v) => v.trim()).filter(Boolean);diff --git a/github-action/src/inputs.ts b/github-action/src/inputs.tsindex afd9ac8d4..1fa6b9267 100644--- a/github-action/src/inputs.ts+++ b/github-action/src/inputs.ts@@ -19,8 +19,12 @@ export function parseInputs(read: (name: string) => string, workspace: string) {const value = str(name);if (!value) return undefined;const n = Number(value);- if (!Number.isFinite(n) || (integer && !Number.isSafeInteger(n)) || n < min || n > max)- throw new Error(`${name} must be ${integer ? 'an integer' : 'a number'} between ${min} and ${max}.`);+ if (!Number.isFinite(n) || (integer && !Number.isSafeInteger(n)) || n < min || n > max) {+ const bounds = min === Number.MIN_VALUE+ ? `a positive number${max < Infinity ? ` no greater than ${max}` : ''}`+ : `${integer ? 'an integer' : 'a number'} between ${min} and ${max}`;+ throw new Error(`${name} must be ${bounds}.`);+ }return n;};const list = (name: string) => str(name).split(/\r?\n/).map(v => v.trim()).filter(Boolean);diff --git a/github-action/tests/inputs.test.ts b/github-action/tests/inputs.test.tsindex e91b98d0d..211ecdead 100644--- a/github-action/tests/inputs.test.ts+++ b/github-action/tests/inputs.test.ts@@ -65,7 +65,7 @@ test('Deep scan mode and discovery budgets reject unsupported combinations', ()assert.throws(() => parse({mode:'deep', scope:'diff'}), /mode: deep requires scope: repository/);assert.throws(() => parse({'max-time-hours':'1'}), /max-time-hours requires mode: deep/);for (const value of ['NaN', 'Infinity', '-1', '0', '96.1'])- assert.throws(() => parse({mode:'deep', 'max-time-hours':value}), /max-time-hours/);+ assert.throws(() => parse({mode:'deep', 'max-time-hours':value}), {message: 'max-time-hours must be a positive number no greater than 96.'});assert.equal(parse({mode:'deep', 'max-time-hours':'96'}).maxTimeHours, 96);});test('verbose diagnostics default on and can be explicitly disabled', () => {@@ -79,11 +79,11 @@ test('only repository and diff scopes are supported, with separate path and diffassert.throws(() => parse({'diff-base':'HEAD~1'}), /requires scope: diff/);});test('numeric and boolean parsing follows their documented types', () => {- for (const value of ['NaN','Infinity','-1','0','10 dollars']) assert.throws(() => parse({'max-cost':value}));+ for (const value of ['NaN','Infinity','-1','0','10 dollars']) assert.throws(() => parse({'max-cost':value}), {message: 'max-cost must be a positive number.'});assert.equal(parse({'max-cost':'1e99'}).maxCost, 1e99);assert.equal(parse({'max-cost':'1e-2'}).maxCost, 0.01);for (const value of ['yes','TRUE','1']) assert.throws(() => parse({verbose:value}));- for (const value of ['0','1.5','91']) assert.throws(() => parse({'retention-days':value}));+ for (const value of ['0','1.5','91']) assert.throws(() => parse({'retention-days':value}), {message: 'retention-days must be an integer between 1 and 90.'});});test('path lists accept literal filenames but reject unsafe locations and option injection', () => {assert.deepEqual(parse({paths:'src/my folder\nlib'}).paths, ['src/my folder','lib']);