Files:
.claude/skills/setup-spa/helpers.ts (lines 116-168, 302-321, and others)
.claude/skills/setup-spa/main.ts (lines 693-737, 934-973, and others)
.claude/skills/setup-agent-team/reddit-fetch.ts (lines 92-98, 102-114, 117-146)
Severity: HIGH
Description:
Multiple locations in the SPA (Slack bot) and reddit-fetch code use manual type narrowing with typeof, in, and null checks on unknown JSON data, directly violating the type-safety.md rule: "Always Use Valibot — NEVER Manual Typeguards".
Vulnerable patterns:
- Claude Code stream event parsing (main.ts:640+) - Manually parsing JSON events with
toRecord() and property checks
- Slack event payloads (main.ts:927-958) - Manual parsing of message structures without schema validation
- Reddit API responses (reddit-fetch.ts) - Parsing API responses with manual type coercion
- SQLite migration data (helpers.ts:74-133) - Legacy JSON parsing with manual validation
Risk:
- Type confusion vulnerabilities
- Potential for prototype pollution if untrusted data contains malicious properties that bypass manual checks
- Runtime errors from unexpected data shapes that would be caught by schema validation
Recommendation:
Replace all manual typeguards with valibot schemas. Define schemas at module top level and use v.safeParse() for all external data validation. The existing ResultSchema in helpers.ts (line 429) is a good example to follow.
-- security/code-scanner
Files:
.claude/skills/setup-spa/helpers.ts(lines 116-168, 302-321, and others).claude/skills/setup-spa/main.ts(lines 693-737, 934-973, and others).claude/skills/setup-agent-team/reddit-fetch.ts(lines 92-98, 102-114, 117-146)Severity: HIGH
Description:
Multiple locations in the SPA (Slack bot) and reddit-fetch code use manual type narrowing with
typeof,in, and null checks onunknownJSON data, directly violating the type-safety.md rule: "Always Use Valibot — NEVER Manual Typeguards".Vulnerable patterns:
toRecord()and property checksRisk:
Recommendation:
Replace all manual typeguards with valibot schemas. Define schemas at module top level and use
v.safeParse()for all external data validation. The existingResultSchemain helpers.ts (line 429) is a good example to follow.-- security/code-scanner