Skip to content

Commit 1a1b6cc

Browse files
fix(security): suppress prototype-pollution-loop false positive in check-types-sync.ts (#298)
The scheduled `mise run security` suite is RED on main because semgrep's `prototype-pollution-loop` rule flags scripts/check-types-sync.ts:286: value = (value as Record<string, unknown>)[seg]; This is a false positive. resolveConstantsReference walks a property chain *down* SHARED_CONSTANTS (the build-time-trusted contracts/constants.json): it reads value[seg] and reassigns the local `value`, and never assigns to any object property, so there is no prototype-pollution sink. The `seg` keys come from this script's own TypeScript AST, not external input. Suppress inline with a justified nosemgrep, matching the repo convention (cli/src/commands/submit.ts:232, agent/src/config.py:165). Keeping it inline leaves every other prototype-pollution site gated. Verified: `semgrep scan --config auto scripts/check-types-sync.ts` now reports 0 findings (0 blocking). Closes #283 Refs #297
1 parent 5d28f14 commit 1a1b6cc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

scripts/check-types-sync.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ function resolveConstantsReference(
283283
let value: unknown = SHARED_CONSTANTS;
284284
for (const seg of segments) {
285285
if (value == null || typeof value !== 'object') return undefined;
286+
// nosemgrep: javascript.lang.security.audit.prototype-pollution.prototype-pollution-loop.prototype-pollution-loop -- read-only walk down build-time-trusted contracts/constants.json; `seg` keys come from this script's own TS AST, not external input, and no object property is ever assigned (value is reassigned, never written).
286287
value = (value as Record<string, unknown>)[seg];
287288
}
288289
if (value == null || typeof value === 'object') return undefined;

0 commit comments

Comments
 (0)