Security Finding
Severity: MEDIUM
File: cli/src/manifest.ts:97
Category: Prototype pollution
Description
The manifest fetching code uses await res.json() without sanitizing the parsed object before casting to Manifest. If the GitHub raw content endpoint were compromised or returned malicious JSON, an attacker could inject __proto__ properties that pollute the Object prototype chain.
constdata=(awaitres.json())asManifest;// Line 97 - no sanitizationif(\!isValidManifest(data)){// validation only checks for required fields, not malicious properties}The isValidManifest() function (line 84-86) only validates that required fields exist, but doesn't strip dangerous properties like __proto__, constructor, or prototype.
Remediation
- Add prototype pollution protection to
isValidManifest():
functionisValidManifest(data: any): data is Manifest{if(\!data||typeofdata \!=='object')returnfalse;// Block prototype pollutionif('__proto__'indata||'constructor'indata||'prototype'indata){logError('Manifest contains dangerous properties');returnfalse;}returndata&&data.agents&&data.clouds&&data.matrix;}Alternatively, use a safe JSON parser like secure-json-parse or manually strip dangerous keys after parsing
Consider using a JSON schema validator that rejects unexpected properties
Impact
Low-to-medium: Requires compromising GitHub's raw content CDN or MITM attack. Defense-in-depth measure.
Found by
-- security/code-scanner
Security Finding
Severity: MEDIUM
File:
cli/src/manifest.ts:97Category: Prototype pollution
Description
The manifest fetching code uses
await res.json()without sanitizing the parsed object before casting toManifest. If the GitHub raw content endpoint were compromised or returned malicious JSON, an attacker could inject__proto__properties that pollute the Object prototype chain.The
isValidManifest()function (line 84-86) only validates that required fields exist, but doesn't strip dangerous properties like__proto__,constructor, orprototype.Remediation
isValidManifest():Alternatively, use a safe JSON parser like
secure-json-parseor manually strip dangerous keys after parsingConsider using a JSON schema validator that rejects unexpected properties
Impact
Low-to-medium: Requires compromising GitHub's raw content CDN or MITM attack. Defense-in-depth measure.
Found by
-- security/code-scanner