llm-scanner 0.1.15 → 0.1.16
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/reporter.js +24 -4
- package/package.json +1 -1
package/dist/reporter.js
CHANGED
|
@@ -109,11 +109,28 @@ function printFinalReport(results, verbose, debug = false) {
|
|
|
109
109
|
const confidence = confidenceForFail(reason, sample.rawResponse);
|
|
110
110
|
const reproBody = JSON.stringify({ message: sample.attack.prompt });
|
|
111
111
|
const categories = Array.from(new Set(group.map((g) => g.attack.category)));
|
|
112
|
-
const
|
|
113
|
-
|
|
112
|
+
const isSystemPromptLeak = reason.toLowerCase().includes("system_prompt");
|
|
113
|
+
const title = isSystemPromptLeak
|
|
114
|
+
? "Internal system prompt exposed in API response"
|
|
115
|
+
: "Critical security issue detected in API response";
|
|
116
|
+
console.log(` ${chalk_1.default.red("🔴 CRITICAL ISSUE DETECTED")}`);
|
|
114
117
|
console.log();
|
|
115
|
-
console.log(
|
|
116
|
-
console.log(` ${
|
|
118
|
+
console.log(` ${chalk_1.default.bold("Title:")}`);
|
|
119
|
+
console.log(` ${title}`);
|
|
120
|
+
console.log();
|
|
121
|
+
console.log(` ${chalk_1.default.bold("Explanation:")}`);
|
|
122
|
+
if (isSystemPromptLeak) {
|
|
123
|
+
console.log(' Your API is returning internal system instructions ("system_prompt") to the user.');
|
|
124
|
+
console.log(" This is sensitive data and should never be exposed.");
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
console.log(` ${reason}`);
|
|
128
|
+
}
|
|
129
|
+
console.log();
|
|
130
|
+
console.log(` ${chalk_1.default.bold("Impact:")}`);
|
|
131
|
+
console.log(" * Users can see hidden instructions");
|
|
132
|
+
console.log(" * Attackers can reverse engineer behavior");
|
|
133
|
+
console.log(" * May weaken safety protections");
|
|
117
134
|
console.log();
|
|
118
135
|
console.log(" --- TRIGGERED BY ---");
|
|
119
136
|
for (const category of categories) {
|
|
@@ -127,6 +144,9 @@ function printFinalReport(results, verbose, debug = false) {
|
|
|
127
144
|
console.log(" FULL RESPONSE:");
|
|
128
145
|
console.log(` ${sample.rawResponse || "(empty)"}`);
|
|
129
146
|
console.log();
|
|
147
|
+
console.log(" --- EVIDENCE ---");
|
|
148
|
+
console.log(` ${reason}`);
|
|
149
|
+
console.log();
|
|
130
150
|
console.log(" --- REPRODUCE ---");
|
|
131
151
|
console.log(" curl -X POST <endpoint> \\");
|
|
132
152
|
console.log(' -H "Content-Type: application/json" \\');
|