Skip to content

Context7 Platform -- Up-to-date docs for AI agents

feat: prompt injection error (#1536)

Fahreddin Özcanddf9cdbbc7f9
diff --git a/packages/cli/src/commands/skill.ts b/packages/cli/src/commands/skill.ts
index 6fd9dbd4..bbcb9490 100644
--- a/packages/cli/src/commands/skill.ts
+++ b/packages/cli/src/commands/skill.ts
@@ -175,7 +175,12 @@ async function installCommand(
const skillData = await getSkill(repo, skillName);
if (skillData.error || !skillData.name) {
- spinner.fail(pc.red(`Skill not found: ${skillName}`));
+ if (skillData.error === "prompt_injection_detected") {
+ spinner.fail(pc.red(`Prompt injection detected in skill: ${skillName}`));
+ log.warn("This skill contains potentially malicious content and cannot be installed.");
+ } else {
+ spinner.fail(pc.red(`Skill not found: ${skillName}`));
+ }
return;
}
@@ -204,11 +209,19 @@ async function installCommand(
const skillsWithRepo = data.skills.map((s) => ({ ...s, project: repo }));
+ spinner.succeed(`Found ${data.skills.length} skill(s)`);
+
+ if (data.blockedSkillsCount && data.blockedSkillsCount > 0) {
+ log.blank();
+ log.error(
+ `${data.blockedSkillsCount} skill(s) blocked due to prompt injection and not shown.`
+ );
+ log.warn("Review other skills from this repository carefully before installing.");
+ }
+
if (options.all || data.skills.length === 1) {
- spinner.succeed(`Found ${data.skills.length} skill(s)`);
selectedSkills = skillsWithRepo;
} else {
- spinner.succeed(`Found ${data.skills.length} skill(s)`);
const maxNameLen = Math.min(25, Math.max(...data.skills.map((s) => s.name.length)));
const choices = skillsWithRepo.map((s) => {
const paddedName = s.name.padEnd(maxNameLen);
diff --git a/packages/cli/src/types.ts b/packages/cli/src/types.ts
index 0082b731..bbfd2ccc 100644
--- a/packages/cli/src/types.ts
+++ b/packages/cli/src/types.ts
@@ -16,6 +16,7 @@ export interface SkillSearchResult extends Skill {
export interface ListSkillsResponse {
project: string;
skills: Skill[];
+ blockedSkillsCount?: number;
error?: string;
message?: string;
}