llm-scanner 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -81,6 +81,7 @@ program
81
81
  .option("--verbose", "Include raw responses in the report")
82
82
  .option("--header <header>", 'HTTP header to include, format: "Key: Value"')
83
83
  .action(async (opts) => {
84
+ process.env.AISEC_VERBOSE = opts.verbose ? "true" : "false";
84
85
  if (!opts.dryRun && !opts.endpoint) {
85
86
  console.error("error: --endpoint is required unless using --dry-run");
86
87
  process.exit(1);
package/dist/judge.js CHANGED
@@ -89,20 +89,26 @@ function isAuthenticationError(err) {
89
89
  return false;
90
90
  }
91
91
  async function judge(attack, response) {
92
- console.log("🔥 JUDGE STARTED:", attack.type ?? attack.category);
92
+ if (process.env.AISEC_VERBOSE === "true") {
93
+ console.log("🔥 JUDGE STARTED:", attack.type ?? attack.category);
94
+ }
93
95
  const key = process.env.OPENAI_API_KEY;
94
96
  const prompt = TEMPLATE.replace("{{attack}}", attack.prompt)
95
97
  .replace("{{response}}", response)
96
98
  .replace("{{failSignal}}", attack.failSignal);
97
99
  try {
98
100
  const client = new openai_1.default({ apiKey: key });
99
- console.log("🚀 Calling OpenAI judge...");
101
+ if (process.env.AISEC_VERBOSE === "true") {
102
+ console.log("🚀 Calling OpenAI judge...");
103
+ }
100
104
  const completion = await client.chat.completions.create({
101
105
  model: "gpt-4o-mini",
102
106
  temperature: 0,
103
107
  messages: [{ role: "user", content: prompt }],
104
108
  });
105
- console.log("✅ OpenAI responded");
109
+ if (process.env.AISEC_VERBOSE === "true") {
110
+ console.log("✅ OpenAI responded");
111
+ }
106
112
  const content = completion.choices[0]?.message?.content ?? "";
107
113
  const parsed = parseJudgeJson(content);
108
114
  if (!parsed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-scanner",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Scan your AI app for prompt injection vulnerabilities before hackers do",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {