@bryan-thompson/inspector-assessment-client 1.27.0 → 1.29.0

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.
Files changed (67) hide show
  1. package/dist/assets/{OAuthCallback-CJWH8Ytw.js → OAuthCallback-9Gbb39Ii.js} +1 -1
  2. package/dist/assets/{OAuthDebugCallback-DL5adXJw.js → OAuthDebugCallback-B76J2MBn.js} +1 -1
  3. package/dist/assets/{index-Cu9XzUwB.js → index-CHTOR9VI.js} +77 -39
  4. package/dist/index.html +1 -1
  5. package/lib/lib/assessment/configTypes.d.ts +1 -0
  6. package/lib/lib/assessment/configTypes.d.ts.map +1 -1
  7. package/lib/lib/assessment/configTypes.js +10 -0
  8. package/lib/lib/assessment/extendedTypes.d.ts +74 -0
  9. package/lib/lib/assessment/extendedTypes.d.ts.map +1 -1
  10. package/lib/lib/assessment/resultTypes.d.ts +11 -1
  11. package/lib/lib/assessment/resultTypes.d.ts.map +1 -1
  12. package/lib/lib/securityPatterns.d.ts +8 -3
  13. package/lib/lib/securityPatterns.d.ts.map +1 -1
  14. package/lib/lib/securityPatterns.js +205 -3
  15. package/lib/services/assessment/AssessmentOrchestrator.d.ts +1 -0
  16. package/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -1
  17. package/lib/services/assessment/AssessmentOrchestrator.js +31 -1
  18. package/lib/services/assessment/modules/FileModularizationAssessor.d.ts +87 -0
  19. package/lib/services/assessment/modules/FileModularizationAssessor.d.ts.map +1 -0
  20. package/lib/services/assessment/modules/FileModularizationAssessor.js +475 -0
  21. package/lib/services/assessment/modules/TemporalAssessor.d.ts +5 -129
  22. package/lib/services/assessment/modules/TemporalAssessor.d.ts.map +1 -1
  23. package/lib/services/assessment/modules/TemporalAssessor.js +18 -554
  24. package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts +10 -70
  25. package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts.map +1 -1
  26. package/lib/services/assessment/modules/ToolAnnotationAssessor.js +32 -625
  27. package/lib/services/assessment/modules/annotations/AlignmentChecker.d.ts +65 -0
  28. package/lib/services/assessment/modules/annotations/AlignmentChecker.d.ts.map +1 -0
  29. package/lib/services/assessment/modules/annotations/AlignmentChecker.js +289 -0
  30. package/lib/services/assessment/modules/annotations/ClaudeIntegration.d.ts +22 -0
  31. package/lib/services/assessment/modules/annotations/ClaudeIntegration.d.ts.map +1 -0
  32. package/lib/services/assessment/modules/annotations/ClaudeIntegration.js +139 -0
  33. package/lib/services/assessment/modules/annotations/EventEmitter.d.ts +20 -0
  34. package/lib/services/assessment/modules/annotations/EventEmitter.d.ts.map +1 -0
  35. package/lib/services/assessment/modules/annotations/EventEmitter.js +100 -0
  36. package/lib/services/assessment/modules/annotations/ExplanationGenerator.d.ts +25 -0
  37. package/lib/services/assessment/modules/annotations/ExplanationGenerator.d.ts.map +1 -0
  38. package/lib/services/assessment/modules/annotations/ExplanationGenerator.js +122 -0
  39. package/lib/services/assessment/modules/annotations/index.d.ts +5 -0
  40. package/lib/services/assessment/modules/annotations/index.d.ts.map +1 -1
  41. package/lib/services/assessment/modules/annotations/index.js +8 -0
  42. package/lib/services/assessment/modules/annotations/types.d.ts +33 -0
  43. package/lib/services/assessment/modules/annotations/types.d.ts.map +1 -0
  44. package/lib/services/assessment/modules/annotations/types.js +7 -0
  45. package/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts +3 -0
  46. package/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts.map +1 -1
  47. package/lib/services/assessment/modules/securityTests/SafeResponseDetector.js +14 -1
  48. package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts +56 -0
  49. package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts.map +1 -1
  50. package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.js +121 -0
  51. package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.d.ts.map +1 -1
  52. package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.js +13 -0
  53. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts.map +1 -1
  54. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.js +24 -0
  55. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +80 -0
  56. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -1
  57. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +273 -3
  58. package/lib/services/assessment/modules/temporal/MutationDetector.d.ts +75 -0
  59. package/lib/services/assessment/modules/temporal/MutationDetector.d.ts.map +1 -0
  60. package/lib/services/assessment/modules/temporal/MutationDetector.js +147 -0
  61. package/lib/services/assessment/modules/temporal/VarianceClassifier.d.ts +112 -0
  62. package/lib/services/assessment/modules/temporal/VarianceClassifier.d.ts.map +1 -0
  63. package/lib/services/assessment/modules/temporal/VarianceClassifier.js +427 -0
  64. package/lib/services/assessment/modules/temporal/index.d.ts +10 -0
  65. package/lib/services/assessment/modules/temporal/index.d.ts.map +1 -0
  66. package/lib/services/assessment/modules/temporal/index.js +9 -0
  67. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Explanation Generator Module
3
+ * Generates explanations and recommendations for annotation assessment results
4
+ *
5
+ * Extracted from ToolAnnotationAssessor.ts as part of Issue #105 refactoring.
6
+ */
7
+ import type { ToolAnnotationResult } from "../../../../lib/assessmentTypes.js";
8
+ import type { EnhancedToolAnnotationResult } from "./types.js";
9
+ /**
10
+ * Generate basic explanation for annotation assessment
11
+ */
12
+ export declare function generateExplanation(annotatedCount: number, missingCount: number, misalignedCount: number, totalTools: number): string;
13
+ /**
14
+ * Generate enhanced explanation with Claude analysis
15
+ */
16
+ export declare function generateEnhancedExplanation(annotatedCount: number, missingCount: number, highConfidenceMisalignments: number, totalTools: number): string;
17
+ /**
18
+ * Generate recommendations for annotation issues
19
+ */
20
+ export declare function generateRecommendations(results: ToolAnnotationResult[]): string[];
21
+ /**
22
+ * Generate enhanced recommendations with Claude analysis
23
+ */
24
+ export declare function generateEnhancedRecommendations(results: EnhancedToolAnnotationResult[]): string[];
25
+ //# sourceMappingURL=ExplanationGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExplanationGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/annotations/ExplanationGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE5D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,GACjB,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,2BAA2B,EAAE,MAAM,EACnC,UAAU,EAAE,MAAM,GACjB,MAAM,CA0BR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,oBAAoB,EAAE,GAC9B,MAAM,EAAE,CAuCV;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,4BAA4B,EAAE,GACtC,MAAM,EAAE,CA2EV"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Explanation Generator Module
3
+ * Generates explanations and recommendations for annotation assessment results
4
+ *
5
+ * Extracted from ToolAnnotationAssessor.ts as part of Issue #105 refactoring.
6
+ */
7
+ /**
8
+ * Generate basic explanation for annotation assessment
9
+ */
10
+ export function generateExplanation(annotatedCount, missingCount, misalignedCount, totalTools) {
11
+ const parts = [];
12
+ if (totalTools === 0) {
13
+ return "No tools found to assess for annotations.";
14
+ }
15
+ parts.push(`Tool annotation coverage: ${annotatedCount}/${totalTools} tools have annotations.`);
16
+ if (missingCount > 0) {
17
+ parts.push(`${missingCount} tool(s) are missing required annotations (readOnlyHint, destructiveHint).`);
18
+ }
19
+ if (misalignedCount > 0) {
20
+ parts.push(`${misalignedCount} tool(s) have potentially misaligned annotations based on naming patterns.`);
21
+ }
22
+ if (missingCount === 0 && misalignedCount === 0) {
23
+ parts.push("All tools are properly annotated.");
24
+ }
25
+ return parts.join(" ");
26
+ }
27
+ /**
28
+ * Generate enhanced explanation with Claude analysis
29
+ */
30
+ export function generateEnhancedExplanation(annotatedCount, missingCount, highConfidenceMisalignments, totalTools) {
31
+ const parts = [];
32
+ if (totalTools === 0) {
33
+ return "No tools found to assess for annotations.";
34
+ }
35
+ parts.push(`Tool annotation coverage: ${annotatedCount}/${totalTools} tools have annotations.`);
36
+ if (missingCount > 0) {
37
+ parts.push(`${missingCount} tool(s) are missing required annotations (readOnlyHint, destructiveHint).`);
38
+ }
39
+ if (highConfidenceMisalignments > 0) {
40
+ parts.push(`Claude analysis identified ${highConfidenceMisalignments} high-confidence annotation misalignment(s).`);
41
+ }
42
+ parts.push("Analysis enhanced with Claude semantic behavior inference.");
43
+ return parts.join(" ");
44
+ }
45
+ /**
46
+ * Generate recommendations for annotation issues
47
+ */
48
+ export function generateRecommendations(results) {
49
+ const recommendations = [];
50
+ const allRecs = new Set();
51
+ for (const result of results) {
52
+ for (const rec of result.recommendations) {
53
+ allRecs.add(rec);
54
+ }
55
+ }
56
+ const destructiveRecs = Array.from(allRecs).filter((r) => r.includes("destructive"));
57
+ const otherRecs = Array.from(allRecs).filter((r) => !r.includes("destructive"));
58
+ if (destructiveRecs.length > 0) {
59
+ recommendations.push("PRIORITY: The following tools appear to perform destructive operations but lack proper destructiveHint annotation:");
60
+ recommendations.push(...destructiveRecs.slice(0, 5));
61
+ }
62
+ if (otherRecs.length > 0) {
63
+ recommendations.push(...otherRecs.slice(0, 5));
64
+ }
65
+ if (recommendations.length === 0) {
66
+ recommendations.push("All tools have proper annotations. No action required.");
67
+ }
68
+ else {
69
+ recommendations.push("Reference: MCP Directory Policy #17 requires tools to have readOnlyHint and destructiveHint annotations.");
70
+ }
71
+ return recommendations;
72
+ }
73
+ /**
74
+ * Generate enhanced recommendations with Claude analysis
75
+ */
76
+ export function generateEnhancedRecommendations(results) {
77
+ const recommendations = [];
78
+ const claudeMisalignments = results.filter((r) => r.claudeInference &&
79
+ r.claudeInference.source === "claude-inferred" &&
80
+ r.claudeInference.confidence >= 70 &&
81
+ r.claudeInference.misalignmentDetected);
82
+ if (claudeMisalignments.length > 0) {
83
+ recommendations.push("HIGH CONFIDENCE: Claude analysis identified the following annotation issues:");
84
+ for (const result of claudeMisalignments.slice(0, 5)) {
85
+ if (result.claudeInference) {
86
+ recommendations.push(` - ${result.toolName}: ${result.claudeInference.reasoning}`);
87
+ }
88
+ }
89
+ }
90
+ const claudeSuggestions = results
91
+ .filter((r) => r.claudeInference &&
92
+ r.claudeInference.source === "claude-inferred" &&
93
+ r.claudeInference.confidence >= 60)
94
+ .flatMap((r) => r.recommendations.filter((rec) => rec.includes("Claude")));
95
+ if (claudeSuggestions.length > 0) {
96
+ recommendations.push(...claudeSuggestions.slice(0, 5));
97
+ }
98
+ const patternRecs = new Set();
99
+ for (const result of results) {
100
+ for (const rec of result.recommendations) {
101
+ if (!rec.includes("Claude")) {
102
+ patternRecs.add(rec);
103
+ }
104
+ }
105
+ }
106
+ const destructiveRecs = Array.from(patternRecs).filter((r) => r.includes("destructive"));
107
+ const otherRecs = Array.from(patternRecs).filter((r) => !r.includes("destructive"));
108
+ if (destructiveRecs.length > 0) {
109
+ recommendations.push("PRIORITY: Potential destructive tools without proper hints:");
110
+ recommendations.push(...destructiveRecs.slice(0, 3));
111
+ }
112
+ if (otherRecs.length > 0 && recommendations.length < 10) {
113
+ recommendations.push(...otherRecs.slice(0, 3));
114
+ }
115
+ if (recommendations.length === 0) {
116
+ recommendations.push("All tools have proper annotations. No action required.");
117
+ }
118
+ else {
119
+ recommendations.push("Reference: MCP Directory Policy #17 requires tools to have readOnlyHint and destructiveHint annotations.");
120
+ }
121
+ return recommendations;
122
+ }
@@ -10,4 +10,9 @@ export { inferBehavior, inferBehaviorEnhanced, type BehaviorInferenceResult, } f
10
10
  export { analyzeDescription, hasReadOnlyIndicators, hasDestructiveIndicators, hasWriteIndicators, DESCRIPTION_BEHAVIOR_KEYWORDS, } from "./DescriptionAnalyzer.js";
11
11
  export { analyzeInputSchema, analyzeOutputSchema, hasBulkOperationIndicators, hasPaginationParameters, hasForceFlags, INPUT_READONLY_PATTERNS, INPUT_DESTRUCTIVE_PATTERNS, INPUT_WRITE_PATTERNS, OUTPUT_READONLY_PATTERNS, OUTPUT_DESTRUCTIVE_PATTERNS, OUTPUT_WRITE_PATTERNS, type JSONSchema, } from "./SchemaAnalyzer.js";
12
12
  export { detectArchitecture, hasDatabaseToolPatterns, extractDatabasesFromDependencies, type Tool as ArchitectureTool, type ArchitectureContext, } from "./ArchitectureDetector.js";
13
+ export { type ClaudeInference, type EnhancedToolAnnotationResult, } from "./types.js";
14
+ export { extractAnnotations, extractExtendedMetadata, extractToolParams, assessSingleTool, determineAnnotationStatus, calculateMetrics, type ExtractedAnnotations, type AlignmentMetricsResult, } from "./AlignmentChecker.js";
15
+ export { generateExplanation, generateEnhancedExplanation, generateRecommendations, generateEnhancedRecommendations, } from "./ExplanationGenerator.js";
16
+ export { emitAnnotationEvents, emitMismatchEvent } from "./EventEmitter.js";
17
+ export { enhanceWithClaudeInference, createPatternBasedInference, } from "./ClaudeIntegration.js";
13
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/annotations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,kCAAkC,EAClC,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,GACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,KAAK,IAAI,IAAI,gBAAgB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/annotations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,kCAAkC,EAClC,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,GACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,KAAK,IAAI,IAAI,gBAAgB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,4BAA4B,GAClC,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC"}
@@ -13,3 +13,11 @@ export { analyzeDescription, hasReadOnlyIndicators, hasDestructiveIndicators, ha
13
13
  export { analyzeInputSchema, analyzeOutputSchema, hasBulkOperationIndicators, hasPaginationParameters, hasForceFlags, INPUT_READONLY_PATTERNS, INPUT_DESTRUCTIVE_PATTERNS, INPUT_WRITE_PATTERNS, OUTPUT_READONLY_PATTERNS, OUTPUT_DESTRUCTIVE_PATTERNS, OUTPUT_WRITE_PATTERNS, } from "./SchemaAnalyzer.js";
14
14
  // Issue #57: Architecture Detector
15
15
  export { detectArchitecture, hasDatabaseToolPatterns, extractDatabasesFromDependencies, } from "./ArchitectureDetector.js";
16
+ // Issue #105: Alignment Checker
17
+ export { extractAnnotations, extractExtendedMetadata, extractToolParams, assessSingleTool, determineAnnotationStatus, calculateMetrics, } from "./AlignmentChecker.js";
18
+ // Issue #105: Explanation Generator
19
+ export { generateExplanation, generateEnhancedExplanation, generateRecommendations, generateEnhancedRecommendations, } from "./ExplanationGenerator.js";
20
+ // Issue #105: Event Emitter
21
+ export { emitAnnotationEvents, emitMismatchEvent } from "./EventEmitter.js";
22
+ // Issue #105: Claude Integration
23
+ export { enhanceWithClaudeInference, createPatternBasedInference, } from "./ClaudeIntegration.js";
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared Types for Annotation Assessment Modules
3
+ *
4
+ * Consolidates common type definitions used across annotation helper modules.
5
+ * Created as part of Issue #105 refactoring to eliminate duplicate definitions.
6
+ */
7
+ import type { ToolAnnotationResult } from "../../../../lib/assessmentTypes.js";
8
+ /**
9
+ * Claude inference result structure
10
+ * Contains semantic analysis of tool behavior from Claude
11
+ */
12
+ export interface ClaudeInference {
13
+ expectedReadOnly: boolean;
14
+ expectedDestructive: boolean;
15
+ confidence: number;
16
+ reasoning: string;
17
+ suggestedAnnotations: {
18
+ readOnlyHint?: boolean;
19
+ destructiveHint?: boolean;
20
+ idempotentHint?: boolean;
21
+ };
22
+ misalignmentDetected: boolean;
23
+ misalignmentDetails?: string;
24
+ source: "claude-inferred" | "pattern-based";
25
+ }
26
+ /**
27
+ * Enhanced tool annotation result with Claude inference
28
+ * Extends the base result with optional Claude semantic analysis
29
+ */
30
+ export interface EnhancedToolAnnotationResult extends ToolAnnotationResult {
31
+ claudeInference?: ClaudeInference;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/annotations/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE;QACpB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,oBAAoB,EAAE,OAAO,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;CAC7C;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared Types for Annotation Assessment Modules
3
+ *
4
+ * Consolidates common type definitions used across annotation helper modules.
5
+ * Created as part of Issue #105 refactoring to eliminate duplicate definitions.
6
+ */
7
+ export {};
@@ -37,6 +37,9 @@ export declare class SafeResponseDetector {
37
37
  /**
38
38
  * Check if response is just reflection (safe)
39
39
  * Two-layer defense: Match reflection patterns, verify NO execution evidence
40
+ *
41
+ * Issue #110, Challenge #8: Also checks for LLM injection markers and
42
+ * output injection vulnerability metadata before declaring response safe.
40
43
  */
41
44
  isReflectionResponse(responseText: string): boolean;
42
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SafeResponseDetector.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SafeResponseDetector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAcjF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,iBAAiB,CAA4B;;IAMrD;;OAEG;IACH,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO;IAQzE;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIlD;;;OAGG;IACH,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAkEnD;;OAEG;IACH,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIrD;;OAEG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIjD;;OAEG;IACH,qBAAqB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO;IA0CrE;;OAEG;IACH,sBAAsB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM;CAUtE"}
1
+ {"version":3,"file":"SafeResponseDetector.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SafeResponseDetector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAgBjF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,iBAAiB,CAA4B;;IAMrD;;OAEG;IACH,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO;IAQzE;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIlD;;;;;;OAMG;IACH,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IA8EnD;;OAEG;IACH,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIrD;;OAEG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIjD;;OAEG;IACH,qBAAqB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO;IA0CrE;;OAEG;IACH,sBAAsB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM;CAUtE"}
@@ -5,7 +5,7 @@
5
5
  * Extracted from SecurityResponseAnalyzer.ts (Issue #53)
6
6
  * Handles: MCP validation, HTTP errors, reflection detection, validation rejection
7
7
  */
8
- import { VALIDATION_ERROR_PATTERNS, STATUS_PATTERNS, REFLECTION_PATTERNS, SEARCH_RESULT_PATTERNS, CREATION_PATTERNS, TEXT_REJECTION_PATTERNS, RESULT_REJECTION_PATTERNS, isHttpError, matchesAny, } from "./SecurityPatternLibrary.js";
8
+ import { VALIDATION_ERROR_PATTERNS, STATUS_PATTERNS, REFLECTION_PATTERNS, SEARCH_RESULT_PATTERNS, CREATION_PATTERNS, TEXT_REJECTION_PATTERNS, RESULT_REJECTION_PATTERNS, isHttpError, matchesAny, hasLLMInjectionMarkers, hasOutputInjectionVulnerability, } from "./SecurityPatternLibrary.js";
9
9
  import { ExecutionArtifactDetector } from "./ExecutionArtifactDetector.js";
10
10
  /**
11
11
  * Detects safe response patterns indicating proper tool behavior
@@ -33,8 +33,21 @@ export class SafeResponseDetector {
33
33
  /**
34
34
  * Check if response is just reflection (safe)
35
35
  * Two-layer defense: Match reflection patterns, verify NO execution evidence
36
+ *
37
+ * Issue #110, Challenge #8: Also checks for LLM injection markers and
38
+ * output injection vulnerability metadata before declaring response safe.
36
39
  */
37
40
  isReflectionResponse(responseText) {
41
+ // Issue #110: Check for LLM injection markers BEFORE reflection check
42
+ // If response contains <IMPORTANT>, [INST], or similar markers, it's not safe
43
+ if (hasLLMInjectionMarkers(responseText)) {
44
+ return false; // Not safe - contains potential LLM injection
45
+ }
46
+ // Issue #110: Check for output injection vulnerability metadata
47
+ // If tool self-reports raw_content_included or injection risk, it's not safe
48
+ if (hasOutputInjectionVulnerability(responseText)) {
49
+ return false; // Not safe - tool reports output injection vulnerability
50
+ }
38
51
  // Combine status patterns and reflection patterns
39
52
  const allReflectionPatterns = [...STATUS_PATTERNS, ...REFLECTION_PATTERNS];
40
53
  const hasReflection = matchesAny(allReflectionPatterns, responseText);
@@ -40,6 +40,25 @@ export declare const EXECUTION_ARTIFACT_PATTERNS: {
40
40
  /** Context-sensitive - only count if no echoed payload */
41
41
  readonly contextSensitive: readonly [RegExp, RegExp, RegExp];
42
42
  };
43
+ /**
44
+ * Patterns for detecting LLM prompt injection markers in tool output
45
+ * These indicate potential indirect prompt injection (output injection)
46
+ * Used by: hasLLMInjectionMarkers()
47
+ *
48
+ * When tool output contains these markers, it may flow to the orchestrating
49
+ * LLM and influence its behavior - a security concern for MCP integrations.
50
+ */
51
+ export declare const LLM_INJECTION_MARKERS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
52
+ /**
53
+ * Patterns for detecting output injection vulnerability metadata
54
+ * Tools that self-report vulnerability status
55
+ */
56
+ export declare const OUTPUT_INJECTION_METADATA: {
57
+ /** Tool reports it includes raw/unsanitized content */
58
+ readonly rawContentIncluded: readonly [RegExp, RegExp, RegExp];
59
+ /** Tool reports vulnerability in output handling */
60
+ readonly vulnerableOutput: readonly [RegExp, RegExp, RegExp, RegExp];
61
+ };
43
62
  /**
44
63
  * Patterns for connection/server errors
45
64
  * Used by: isConnectionError(), isConnectionErrorFromException()
@@ -334,6 +353,33 @@ export declare const STRUCTURED_DATA_INDICATORS: {
334
353
  readonly jsonPattern: RegExp;
335
354
  readonly numericMetadataPattern: RegExp;
336
355
  };
356
+ /**
357
+ * Patterns for detecting secret/credential leakage in tool responses
358
+ * Used by: checkSecretLeakage()
359
+ */
360
+ export declare const SECRET_LEAKAGE_PATTERNS: {
361
+ /** Well-known API key formats */
362
+ readonly apiKeys: readonly [RegExp, RegExp, RegExp, RegExp, RegExp];
363
+ /** Database connection strings with credentials */
364
+ readonly connectionStrings: readonly [RegExp];
365
+ /** Environment variable patterns with values */
366
+ readonly envVars: readonly [RegExp];
367
+ /** Partial key exposure patterns */
368
+ readonly partialKeys: readonly [RegExp];
369
+ /** Generic credential assignment patterns */
370
+ readonly credentialAssignment: readonly [RegExp];
371
+ };
372
+ /**
373
+ * Patterns for detecting tool output injection vulnerabilities
374
+ * Detects when user content is echoed unsanitized in tool output
375
+ * Used by: analyzeOutputInjection()
376
+ */
377
+ export declare const OUTPUT_INJECTION_PATTERNS: {
378
+ /** LLM control patterns that should be sanitized */
379
+ readonly llmControl: readonly [RegExp, RegExp, RegExp, RegExp];
380
+ /** Canary markers for echo detection */
381
+ readonly canaryMarkers: readonly [RegExp];
382
+ };
337
383
  /**
338
384
  * Check if any pattern in array matches text
339
385
  */
@@ -346,4 +392,14 @@ export declare function isHttpError(text: string): boolean;
346
392
  * Check if response has MCP error prefix
347
393
  */
348
394
  export declare function hasMcpErrorPrefix(text: string): boolean;
395
+ /**
396
+ * Check if text contains LLM injection markers (Issue #110, Challenge #8)
397
+ * Detects XML-style tags, chat format markers, and instruction overrides
398
+ */
399
+ export declare function hasLLMInjectionMarkers(text: string): boolean;
400
+ /**
401
+ * Check if response indicates output injection vulnerability (Issue #110, Challenge #8)
402
+ * Detects tools that self-report including raw/unsanitized content
403
+ */
404
+ export declare function hasOutputInjectionVulnerability(text: string): boolean;
349
405
  //# sourceMappingURL=SecurityPatternLibrary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityPatternLibrary.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityPatternLib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;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD"}
1
+ {"version":3,"file":"SecurityPatternLibrary.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityPatternLibrary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAC9B,kEAAkE;;IAIlE,8DAA8D;;IAG9D,kCAAkC;;IAGlC,gCAAgC;;CAExB,CAAC;AAMX;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,2JAmB5B,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,oBAAoB,2LAuBvB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,2BAA2B;IACtC,iCAAiC;;IAejC,0DAA0D;;CAElD,CAAC;AAMX;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,2KA4BxB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,yBAAyB;IACpC,uDAAuD;;IAOvD,oDAAoD;;CAO5C,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,yBAAyB;IACpC,oCAAoC;;IAqBpC,4DAA4D;;IAW5D,+BAA+B;;CAEvB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;CAMhC,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,eAAe,mJAkBlB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,mBAAmB,2rBAwGtB,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B1B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc5B,CAAC;AAMX;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;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;;;GAGG;AACH,eAAO,MAAM,2BAA2B,QACO,CAAC;AAMhD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAC8B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,wBAAwB,2EAS3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,2BAA2B,oRA4B9B,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;CAK7B,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC,iCAAiC;;IAQjC,mDAAmD;;IAInD,gDAAgD;;IAIhD,oCAAoC;;IAEpC,6CAA6C;;CAIrC,CAAC;AAMX;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;IACpC,oDAAoD;;IAOpD,wCAAwC;;CAEhC,CAAC;AAMX;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKrE"}
@@ -104,6 +104,62 @@ export const EXECUTION_ARTIFACT_PATTERNS = {
104
104
  contextSensitive: [/\/etc\/passwd/i, /\/etc\/shadow/i, /file:\/\/\//i],
105
105
  };
106
106
  // =============================================================================
107
+ // LLM INJECTION MARKER PATTERNS (Issue #110, Challenge #8)
108
+ // =============================================================================
109
+ /**
110
+ * Patterns for detecting LLM prompt injection markers in tool output
111
+ * These indicate potential indirect prompt injection (output injection)
112
+ * Used by: hasLLMInjectionMarkers()
113
+ *
114
+ * When tool output contains these markers, it may flow to the orchestrating
115
+ * LLM and influence its behavior - a security concern for MCP integrations.
116
+ */
117
+ export const LLM_INJECTION_MARKERS = [
118
+ // XML-style instruction tags
119
+ /<IMPORTANT>/i,
120
+ /<\/IMPORTANT>/i,
121
+ /<SYSTEM>/i,
122
+ /<\/SYSTEM>/i,
123
+ /<INSTRUCTION>/i,
124
+ /<\/INSTRUCTION>/i,
125
+ // Chat model format markers
126
+ /\[INST\]/i,
127
+ /\[\/INST\]/i,
128
+ /<\|system\|>/i,
129
+ /<\|user\|>/i,
130
+ /<\|assistant\|>/i,
131
+ /<\|im_start\|>/i,
132
+ /<\|im_end\|>/i,
133
+ // Template injection patterns
134
+ /\{\{SYSTEM_PROMPT\}\}/i,
135
+ /\{\{USER_INPUT\}\}/i,
136
+ /\{\{ASSISTANT\}\}/i,
137
+ // Instruction override patterns
138
+ /ignore.*previous.*instructions/i,
139
+ /disregard.*above.*instructions/i,
140
+ /new.*instructions.*follow/i,
141
+ /override.*system.*prompt/i,
142
+ ];
143
+ /**
144
+ * Patterns for detecting output injection vulnerability metadata
145
+ * Tools that self-report vulnerability status
146
+ */
147
+ export const OUTPUT_INJECTION_METADATA = {
148
+ /** Tool reports it includes raw/unsanitized content */
149
+ rawContentIncluded: [
150
+ /"raw_content_included"\s*:\s*true/i,
151
+ /"unsanitized"\s*:\s*true/i,
152
+ /"content_sanitized"\s*:\s*false/i,
153
+ ],
154
+ /** Tool reports vulnerability in output handling */
155
+ vulnerableOutput: [
156
+ /enables\s+indirect\s+prompt\s+injection/i,
157
+ /returns\s+unsanitized\s+user\s+content/i,
158
+ /output\s+injection/i,
159
+ /"injection_risk"\s*:\s*true/i,
160
+ ],
161
+ };
162
+ // =============================================================================
107
163
  // CONNECTION ERROR PATTERNS (consolidated from 2 duplicate locations)
108
164
  // =============================================================================
109
165
  /**
@@ -879,6 +935,56 @@ export const STRUCTURED_DATA_INDICATORS = {
879
935
  numericMetadataPattern: /\b(score|count|trust|rating|id|version)\b/i,
880
936
  };
881
937
  // =============================================================================
938
+ // SECRET LEAKAGE PATTERNS (Issue #103, Challenge #9)
939
+ // =============================================================================
940
+ /**
941
+ * Patterns for detecting secret/credential leakage in tool responses
942
+ * Used by: checkSecretLeakage()
943
+ */
944
+ export const SECRET_LEAKAGE_PATTERNS = {
945
+ /** Well-known API key formats */
946
+ apiKeys: [
947
+ /AKIA[A-Z0-9]{16}/, // AWS Access Key
948
+ /sk-[a-zA-Z0-9]{20,}/, // OpenAI Key
949
+ /ghp_[a-zA-Z0-9]{36}/, // GitHub PAT
950
+ /glpat-[a-zA-Z0-9]{20}/, // GitLab PAT
951
+ /xox[baprs]-[a-zA-Z0-9-]+/, // Slack tokens
952
+ ],
953
+ /** Database connection strings with credentials */
954
+ connectionStrings: [
955
+ /(postgresql|mysql|mongodb|redis|mssql):\/\/[^:]+:[^@]+@/i,
956
+ ],
957
+ /** Environment variable patterns with values */
958
+ envVars: [
959
+ /(SECRET_TOKEN|DATABASE_URL|API_KEY|PRIVATE_KEY|DB_PASSWORD)[^\s]*[:=]/i,
960
+ ],
961
+ /** Partial key exposure patterns */
962
+ partialKeys: [/api_key_preview|key_fragment|partial_key/i],
963
+ /** Generic credential assignment patterns */
964
+ credentialAssignment: [
965
+ /(api[_-]?key|secret|password)[^\s]*[:=]\s*["']?[a-zA-Z0-9_-]{10,}/i,
966
+ ],
967
+ };
968
+ // =============================================================================
969
+ // OUTPUT INJECTION PATTERNS (Issue #103, Challenge #8)
970
+ // =============================================================================
971
+ /**
972
+ * Patterns for detecting tool output injection vulnerabilities
973
+ * Detects when user content is echoed unsanitized in tool output
974
+ * Used by: analyzeOutputInjection()
975
+ */
976
+ export const OUTPUT_INJECTION_PATTERNS = {
977
+ /** LLM control patterns that should be sanitized */
978
+ llmControl: [
979
+ /<IMPORTANT>.*<\/IMPORTANT>/is,
980
+ /\[INST\].*\[\/INST\]/is,
981
+ /<\|system\|>.*<\|end\|>/is,
982
+ /\{\{.*\}\}/, // Template vars
983
+ ],
984
+ /** Canary markers for echo detection */
985
+ canaryMarkers: [/SENTINEL_OUTPUT_MARKER_\d+/],
986
+ };
987
+ // =============================================================================
882
988
  // HELPER FUNCTIONS
883
989
  // =============================================================================
884
990
  /**
@@ -902,3 +1008,18 @@ export function isHttpError(text) {
902
1008
  export function hasMcpErrorPrefix(text) {
903
1009
  return CONNECTION_ERROR_PATTERNS.mcpPrefix.test(text);
904
1010
  }
1011
+ /**
1012
+ * Check if text contains LLM injection markers (Issue #110, Challenge #8)
1013
+ * Detects XML-style tags, chat format markers, and instruction overrides
1014
+ */
1015
+ export function hasLLMInjectionMarkers(text) {
1016
+ return matchesAny(LLM_INJECTION_MARKERS, text);
1017
+ }
1018
+ /**
1019
+ * Check if response indicates output injection vulnerability (Issue #110, Challenge #8)
1020
+ * Detects tools that self-report including raw/unsanitized content
1021
+ */
1022
+ export function hasOutputInjectionVulnerability(text) {
1023
+ return (matchesAny(OUTPUT_INJECTION_METADATA.rawContentIncluded, text) ||
1024
+ matchesAny(OUTPUT_INJECTION_METADATA.vulnerableOutput, text));
1025
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityPayloadGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityPayloadGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,iBAAiB,CAAuC;IAEhE;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAUvC;;OAEG;IACH,oBAAoB,CAClB,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,IAAI,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAwJ1B;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IASjC;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ7C"}
1
+ {"version":3,"file":"SecurityPayloadGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityPayloadGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,iBAAiB,CAAuC;IAEhE;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAUvC;;OAEG;IACH,oBAAoB,CAClB,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,IAAI,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAwK1B;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IASjC;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ7C"}
@@ -130,6 +130,19 @@ export class SecurityPayloadGenerator {
130
130
  }
131
131
  }
132
132
  }
133
+ // VERBOSE MODE TESTING (Issue #103, Challenge #9)
134
+ // For secret_leakage payloads, enable verbose mode to detect additional credential exposure
135
+ if (payload.payloadType === "secret_leakage") {
136
+ for (const [key, prop] of Object.entries(schema.properties)) {
137
+ const propSchema = prop;
138
+ if (propSchema.type === "boolean" &&
139
+ key.toLowerCase() === "verbose" &&
140
+ !(key in params)) {
141
+ params[key] = true; // Enable verbose mode to test for additional leakage
142
+ break;
143
+ }
144
+ }
145
+ }
133
146
  // Fill required parameters with safe defaults
134
147
  for (const [key, prop] of Object.entries(schema.properties)) {
135
148
  const propSchema = prop;
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityPayloadTester.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityPayloadTester.ts"],"names":[],"m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AAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,2BAA2B,CAAC,EACzC,UAAU,CAAC,EAAE,oBAAoB,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA2JhC;;;OAGG;IACG,qBAAqB,CACzB,KAAK,EAAE,IAAI,EAAE,EACb,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,2BAA2B,CAAC,EACzC,UAAU,CAAC,EAAE,oBAAoB,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA8IhC;;OAEG;IACG,WAAW,CACf,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,2BAA2B,CAAC,GACxC,OAAO,CAAC,kBAAkB,CAAC;IAyJ9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
1
+ {"version":3,"file":"SecurityPayloadTester.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityPayloadTester.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAGjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,2BAA2B,EAC3B,IAAI,EACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGL,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAOhC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mBAAmB,CAAC,EAAE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B,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA8IhC;;OAEG;IACG,WAAW,CACf,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,2BAA2B,CAAC,GACxC,OAAO,CAAC,kBAAkB,CAAC;IAsM9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
@@ -319,6 +319,26 @@ export class SecurityPayloadTester {
319
319
  authBypassEvidence: authResult.evidence,
320
320
  };
321
321
  }
322
+ // Issue #110: Analyze blacklist bypass patterns for "Blacklist Bypass" attack type
323
+ let blacklistBypassFields = {};
324
+ if (attackName === "Blacklist Bypass") {
325
+ const bypassResult = this.responseAnalyzer.analyzeBlacklistBypassResponse(response);
326
+ blacklistBypassFields = {
327
+ blacklistBypassDetected: bypassResult.detected,
328
+ blacklistBypassType: bypassResult.bypassType,
329
+ blacklistBypassMethod: bypassResult.bypassMethod,
330
+ blacklistBypassEvidence: bypassResult.evidence,
331
+ };
332
+ }
333
+ // Issue #110: Analyze output injection patterns for Challenge #8
334
+ // Check ALL responses since any tool could have output injection vulnerabilities
335
+ const outputInjectionResult = this.responseAnalyzer.analyzeOutputInjectionResponse(response);
336
+ const outputInjectionFields = {
337
+ outputInjectionDetected: outputInjectionResult.detected,
338
+ outputInjectionType: outputInjectionResult.injectionType,
339
+ outputInjectionMarkers: outputInjectionResult.markers,
340
+ outputInjectionEvidence: outputInjectionResult.evidence,
341
+ };
322
342
  return {
323
343
  testName: attackName,
324
344
  description: payload.description,
@@ -333,6 +353,10 @@ export class SecurityPayloadTester {
333
353
  sanitizationLibraries: combinedSanitization.libraries,
334
354
  // Issue #75: Auth bypass detection fields
335
355
  ...authBypassFields,
356
+ // Issue #110: Blacklist bypass detection fields
357
+ ...blacklistBypassFields,
358
+ // Issue #110: Output injection detection fields (Challenge #8)
359
+ ...outputInjectionFields,
336
360
  ...confidenceResult,
337
361
  };
338
362
  }