fix: exclude intentional prompt fixtures from default scan
This commit is contained in:
parent
a8fc28f9b4
commit
a664863485
|
|
@ -89,6 +89,7 @@ fable-agent plinius godmode "improve explanation quality"
|
|||
### `security`
|
||||
|
||||
- `security scan <target>`: hidden Unicode, reversed tags, fake wrappers, role spoofing, and instruction-smuggling markers
|
||||
- `--include-fixtures`: include intentional red-team fixtures/generators
|
||||
|
||||
### `pai`
|
||||
|
||||
|
|
|
|||
|
|
@ -2576,7 +2576,8 @@ const security = program
|
|||
security
|
||||
.command("scan <target>")
|
||||
.description("Scan files for prompt-injection markers")
|
||||
.action(async (target: string) => {
|
||||
.option("--include-fixtures", "Include intentional red-team fixtures/generators")
|
||||
.action(async (target: string, opts: { includeFixtures?: boolean }) => {
|
||||
const { findPromptInjection } = await import("./core/prompt-injection-safety.js");
|
||||
const root = path.resolve(target);
|
||||
const files: string[] = [];
|
||||
|
|
@ -2591,6 +2592,9 @@ security
|
|||
return;
|
||||
}
|
||||
if (/\.(test|spec)\.(ts|js)$/i.test(file)) return;
|
||||
const rel = path.relative(root, file).replace(/\\/g, "/");
|
||||
// ponytail: default scan ignores our own intentional prompt-injection generator; use --include-fixtures for audit mode.
|
||||
if (!opts.includeFixtures && rel === "src/upgrades/parseltongue.ts") return;
|
||||
if (/\.(md|txt|ts|js|json|yaml|yml)$/i.test(file)) files.push(file);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue