T01 · Skill Instruction Hijacking
- Location
prompts/commit-message.md:41- Finding
Untrusted Git Diff Content Is Inserted Into the Agent Prompt Without Injection Defenses
- Content
View full analysis
{ const stageFlag = staged ? ["--staged"] : []; const [numstatResult, nameStatusResult, rawDiffResult] = await Promise.all([ exec("git", ["diff", ...stageFlag, "--numstat"]).catch(() => ({ stdout: "" })), exec("git", ["diff", ...stageFlag, "--name-status"]).catch(() => ({ stdout: "" })), exec("git", ["diff", ...stageFlag]).catch(() => ({ stdout: "" })), ]); ``` The split-commit prompt similarly includes the complete diff: ```text Complete Diff: {raw_diff} ``` Commit subjects collected from repository history are also retained as examples: ```ts for (const line of lines) { if (CC_BREAKING_RE.test(line)) { counts.cc++; hasBreaking = true; const m = line.match(CC_BREAKING_RE); if (m) detectedTypes.add(m[1]); if (examples.cc.length < 3) examples.cc.push(line); } else if (CC_RE.test(line)) { counts.cc++; const m = line.match(CC_RE); if (m) detectedTypes.add(m[1]); if (examples.cc.length < 3) examples.cc.push(line); } else if (JIRA_RE.test(line)) { counts.jira++; if (examples.jira.length < 3) examples.jira.push(line); } else if (EMOJI_PREFIX_RE.test(line)) { counts.emoji++; if (examples.emoji.length < 3) examples.emoji.push(line); } else { counts.free++; if (examples.free.length < 3) examples.free.push(line); } } ``` ### Technical Anal ...[truncated 2113 chars]- Remediation
View remediation
