@bryan-thompson/inspector-assessment-client 1.35.2 → 1.36.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.
- package/dist/assets/{OAuthCallback-jfmizOMH.js → OAuthCallback-Cfp3Vzdz.js} +1 -1
- package/dist/assets/{OAuthDebugCallback-bU5kKvnt.js → OAuthDebugCallback-7BLaxlcq.js} +1 -1
- package/dist/assets/{index-Ce63ds7G.js → index-B21S7_ML.js} +4 -4
- package/dist/index.html +1 -1
- package/lib/lib/assessment/coreTypes.d.ts +23 -0
- package/lib/lib/assessment/coreTypes.d.ts.map +1 -1
- package/lib/lib/assessment/extendedTypes.d.ts +49 -2
- package/lib/lib/assessment/extendedTypes.d.ts.map +1 -1
- package/lib/lib/assessment/jsonlEventSchemas.d.ts +4 -4
- package/lib/lib/assessment/resultTypes.d.ts +32 -1
- package/lib/lib/assessment/resultTypes.d.ts.map +1 -1
- package/lib/lib/aupPatterns.d.ts +50 -0
- package/lib/lib/aupPatterns.d.ts.map +1 -1
- package/lib/lib/aupPatterns.js +140 -0
- package/lib/lib/moduleScoring.d.ts.map +1 -1
- package/lib/lib/moduleScoring.js +39 -2
- package/lib/lib/securityPatterns.d.ts.map +1 -1
- package/lib/lib/securityPatterns.js +92 -0
- package/lib/services/assessment/modules/DeveloperExperienceAssessor.d.ts +26 -1
- package/lib/services/assessment/modules/DeveloperExperienceAssessor.d.ts.map +1 -1
- package/lib/services/assessment/modules/DeveloperExperienceAssessor.js +160 -1
- package/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts.map +1 -1
- package/lib/services/assessment/modules/ErrorHandlingAssessor.js +15 -0
- package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts +32 -0
- package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts.map +1 -1
- package/lib/services/assessment/modules/ManifestValidationAssessor.js +218 -20
- package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts +5 -0
- package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts.map +1 -1
- package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.js +29 -0
- package/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -1
- package/lib/services/assessment/modules/SecurityAssessor.js +13 -0
- package/lib/services/assessment/modules/annotations/AlignmentChecker.d.ts +7 -2
- package/lib/services/assessment/modules/annotations/AlignmentChecker.d.ts.map +1 -1
- package/lib/services/assessment/modules/annotations/AlignmentChecker.js +116 -18
- package/lib/services/assessment/modules/annotations/index.d.ts +1 -1
- package/lib/services/assessment/modules/annotations/index.d.ts.map +1 -1
- package/lib/services/assessment/modules/annotations/index.js +2 -1
- package/lib/services/assessment/modules/securityTests/ConfidenceScorer.d.ts.map +1 -1
- package/lib/services/assessment/modules/securityTests/ConfidenceScorer.js +28 -0
- package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts +95 -0
- package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts.map +1 -1
- package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.js +174 -0
- package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts.map +1 -1
- package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.js +15 -0
- package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +40 -0
- package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -1
- package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +143 -131
- package/package.json +1 -1
|
@@ -58,6 +58,34 @@ export class ConfidenceScorer {
|
|
|
58
58
|
* @returns Confidence result with manual review requirements
|
|
59
59
|
*/
|
|
60
60
|
calculateConfidence(tool, isVulnerable, evidence, responseText, payload, sanitizationResult) {
|
|
61
|
+
// Issue #146: Extract execution context from evidence if present
|
|
62
|
+
// This handles context classification from SecurityResponseAnalyzer
|
|
63
|
+
const contextMatch = evidence.match(/\[Context: (CONFIRMED|LIKELY_FALSE_POSITIVE|SUSPECTED)/);
|
|
64
|
+
if (contextMatch) {
|
|
65
|
+
const context = contextMatch[1];
|
|
66
|
+
// LIKELY_FALSE_POSITIVE: Payload reflected in error message, not executed
|
|
67
|
+
// Mark as low confidence requiring manual review
|
|
68
|
+
if (context === "LIKELY_FALSE_POSITIVE") {
|
|
69
|
+
return {
|
|
70
|
+
confidence: "low",
|
|
71
|
+
requiresManualReview: true,
|
|
72
|
+
manualReviewReason: "Payload reflected in error message, operation failed",
|
|
73
|
+
reviewGuidance: "The server rejected the operation but echoed the payload in the error. " +
|
|
74
|
+
"Verify if the tool actually processed the payload or just reflected it in the error message. " +
|
|
75
|
+
"Check the HTTP status code and error type to confirm the operation was rejected.",
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// CONFIRMED: Operation succeeded, payload was executed
|
|
79
|
+
// High confidence vulnerability
|
|
80
|
+
if (context === "CONFIRMED") {
|
|
81
|
+
return {
|
|
82
|
+
confidence: "high",
|
|
83
|
+
requiresManualReview: false,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
// SUSPECTED: Ambiguous case - continue with normal scoring but add review flag
|
|
87
|
+
// Will be handled by downstream logic with medium confidence
|
|
88
|
+
}
|
|
61
89
|
// Issue #56: If sanitization is detected, reduce confidence for vulnerabilities
|
|
62
90
|
// This helps reduce false positives on well-protected servers
|
|
63
91
|
if (isVulnerable && sanitizationResult?.detected) {
|
|
@@ -25,6 +25,37 @@ export declare const HTTP_ERROR_PATTERNS: {
|
|
|
25
25
|
* Used by: isMCPValidationError()
|
|
26
26
|
*/
|
|
27
27
|
export declare const VALIDATION_ERROR_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
28
|
+
/**
|
|
29
|
+
* Issue #146: Error context patterns indicating operation failure
|
|
30
|
+
* Used to detect when payload appears in error message (likely false positive)
|
|
31
|
+
* These patterns indicate the server rejected/failed the operation
|
|
32
|
+
*/
|
|
33
|
+
export declare const ERROR_CONTEXT_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
34
|
+
/**
|
|
35
|
+
* Issue #146: Success context patterns indicating operation completion
|
|
36
|
+
* Used to confirm operation actually executed (high confidence vulnerability)
|
|
37
|
+
* These patterns indicate the server processed and returned results
|
|
38
|
+
*/
|
|
39
|
+
export declare const SUCCESS_CONTEXT_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
40
|
+
/**
|
|
41
|
+
* Issue #146: Check if payload appears in error context (likely false positive)
|
|
42
|
+
* @param responseText The full response text from the tool
|
|
43
|
+
* @param payload The payload that was sent to the tool
|
|
44
|
+
* @returns true if payload is reflected in an error context
|
|
45
|
+
*/
|
|
46
|
+
export declare function isPayloadInErrorContext(responseText: string, payload: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Issue #146: Check if response indicates successful operation (high confidence)
|
|
49
|
+
* @param responseText The full response text from the tool
|
|
50
|
+
* @returns true if response indicates operation succeeded
|
|
51
|
+
*/
|
|
52
|
+
export declare function hasSuccessContext(responseText: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Issue #146: Check if response indicates failed operation (error context)
|
|
55
|
+
* @param responseText The full response text from the tool
|
|
56
|
+
* @returns true if response indicates operation failed
|
|
57
|
+
*/
|
|
58
|
+
export declare function hasErrorContext(responseText: string): boolean;
|
|
28
59
|
/**
|
|
29
60
|
* Patterns indicating actual code/command execution
|
|
30
61
|
* Used by: hasExecutionEvidence()
|
|
@@ -380,6 +411,70 @@ export declare const OUTPUT_INJECTION_PATTERNS: {
|
|
|
380
411
|
/** Canary markers for echo detection */
|
|
381
412
|
readonly canaryMarkers: readonly [RegExp];
|
|
382
413
|
};
|
|
414
|
+
/**
|
|
415
|
+
* Patterns indicating scope violation in tool response
|
|
416
|
+
* Detects when tools exceed their declared annotations at runtime
|
|
417
|
+
* CWE-250: Execution with Unnecessary Privileges
|
|
418
|
+
* CWE-269: Improper Privilege Management
|
|
419
|
+
*/
|
|
420
|
+
export declare const SCOPE_VIOLATION_PATTERNS: readonly [{
|
|
421
|
+
readonly pattern: RegExp;
|
|
422
|
+
readonly evidence: "scope_violation: true (tool exceeded declared scope)";
|
|
423
|
+
}, {
|
|
424
|
+
readonly pattern: RegExp;
|
|
425
|
+
readonly evidence: "scope_escalation: true (privilege escalation via input)";
|
|
426
|
+
}, {
|
|
427
|
+
readonly pattern: RegExp;
|
|
428
|
+
readonly evidence: "actual_scope indicates privileged operation";
|
|
429
|
+
}, {
|
|
430
|
+
readonly pattern: RegExp;
|
|
431
|
+
readonly evidence: "privileged_data exposed in response";
|
|
432
|
+
}, {
|
|
433
|
+
readonly pattern: RegExp;
|
|
434
|
+
readonly evidence: "system_secrets leaked in response";
|
|
435
|
+
}, {
|
|
436
|
+
readonly pattern: RegExp;
|
|
437
|
+
readonly evidence: "Admin mode activated via keyword trigger";
|
|
438
|
+
}];
|
|
439
|
+
/**
|
|
440
|
+
* Patterns indicating safe scope enforcement (hardened behavior)
|
|
441
|
+
* Used to confirm tools properly reject privileged actions
|
|
442
|
+
*/
|
|
443
|
+
export declare const SCOPE_ENFORCED_PATTERNS: readonly [{
|
|
444
|
+
readonly pattern: RegExp;
|
|
445
|
+
readonly evidence: "scope_enforced: true (safe)";
|
|
446
|
+
}, {
|
|
447
|
+
readonly pattern: RegExp;
|
|
448
|
+
readonly evidence: "Action blocked by allowlist";
|
|
449
|
+
}, {
|
|
450
|
+
readonly pattern: RegExp;
|
|
451
|
+
readonly evidence: "Allowlist enforcement";
|
|
452
|
+
}, {
|
|
453
|
+
readonly pattern: RegExp;
|
|
454
|
+
readonly evidence: "Explicit rejection: action not in allowlist";
|
|
455
|
+
}, {
|
|
456
|
+
readonly pattern: RegExp;
|
|
457
|
+
readonly evidence: "No escalation attempted (safe)";
|
|
458
|
+
}, {
|
|
459
|
+
readonly pattern: RegExp;
|
|
460
|
+
readonly evidence: "Allowlist defined and enforced";
|
|
461
|
+
}];
|
|
462
|
+
/**
|
|
463
|
+
* Privileged actions that should be blocked by readOnlyHint=True tools
|
|
464
|
+
*/
|
|
465
|
+
export declare const PRIVILEGED_ACTIONS: readonly ["write", "write_file", "delete", "delete_data", "execute", "execute_command", "network", "network_request", "modify", "modify_config", "admin", "environment_access"];
|
|
466
|
+
/**
|
|
467
|
+
* Escalation keywords that may trigger hidden privilege escalation
|
|
468
|
+
*/
|
|
469
|
+
export declare const ESCALATION_KEYWORDS: readonly ["admin", "sudo", "elevate", "root", "superuser", "privilege"];
|
|
470
|
+
/**
|
|
471
|
+
* Check if response contains scope violation indicators (Issue #144)
|
|
472
|
+
*/
|
|
473
|
+
export declare function hasScopeViolation(text: string): boolean;
|
|
474
|
+
/**
|
|
475
|
+
* Check if response contains scope enforcement indicators (Issue #144)
|
|
476
|
+
*/
|
|
477
|
+
export declare function hasScopeEnforcement(text: string): boolean;
|
|
383
478
|
/**
|
|
384
479
|
* Check if any pattern in array matches text
|
|
385
480
|
*/
|
|
@@ -1 +1 @@
|
|
|
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;;;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G,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"}
|
|
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;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,2GAazB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,mFAU3B,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAWT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE7D;AAMD;;;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;A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AEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAMD;;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"}
|
|
@@ -51,6 +51,75 @@ export const VALIDATION_ERROR_PATTERNS = [
|
|
|
51
51
|
/field.*required/i,
|
|
52
52
|
];
|
|
53
53
|
// =============================================================================
|
|
54
|
+
// ERROR CONTEXT PATTERNS (Issue #146)
|
|
55
|
+
// =============================================================================
|
|
56
|
+
/**
|
|
57
|
+
* Issue #146: Error context patterns indicating operation failure
|
|
58
|
+
* Used to detect when payload appears in error message (likely false positive)
|
|
59
|
+
* These patterns indicate the server rejected/failed the operation
|
|
60
|
+
*/
|
|
61
|
+
export const ERROR_CONTEXT_PATTERNS = [
|
|
62
|
+
/failed\s+to\s+(?:get|read|load|access|process|fetch|retrieve|find)/i,
|
|
63
|
+
/error:\s+response\s+status:\s+\d{3}/i,
|
|
64
|
+
/(?:could\s+not|cannot|unable\s+to)\s+(?:find|locate|access|read|get|load)/i,
|
|
65
|
+
/\b(?:not\s+found|doesn['']t\s+exist|no\s+such|does\s+not\s+exist)\b/i,
|
|
66
|
+
/error\s+(?:loading|reading|processing|fetching|accessing)/i,
|
|
67
|
+
/(?:operation|request)\s+failed/i,
|
|
68
|
+
/invalid\s+(?:path|file|resource|input|parameter)/i,
|
|
69
|
+
/\b(?:rejected|refused|denied)\b/i,
|
|
70
|
+
/(?:resource|file|path)\s+(?:is\s+)?(?:invalid|not\s+allowed)/i,
|
|
71
|
+
/access\s+(?:denied|forbidden)/i,
|
|
72
|
+
/permission\s+denied/i,
|
|
73
|
+
/\b(?:4\d{2}|5\d{2})\s*(?:error|not\s+found|bad\s+request|unauthorized|forbidden)/i,
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* Issue #146: Success context patterns indicating operation completion
|
|
77
|
+
* Used to confirm operation actually executed (high confidence vulnerability)
|
|
78
|
+
* These patterns indicate the server processed and returned results
|
|
79
|
+
*/
|
|
80
|
+
export const SUCCESS_CONTEXT_PATTERNS = [
|
|
81
|
+
/(?:successfully|completed)\s+(?:read|loaded|accessed|executed|retrieved)/i,
|
|
82
|
+
/file\s+contents?:/i,
|
|
83
|
+
/data\s+retrieved/i,
|
|
84
|
+
/execution\s+result:/i,
|
|
85
|
+
/\boutput:/i,
|
|
86
|
+
/\bresults?:/i,
|
|
87
|
+
/returned\s+(?:data|content|results)/i,
|
|
88
|
+
/read\s+\d+\s+bytes/i,
|
|
89
|
+
/fetched\s+(?:from|data)/i,
|
|
90
|
+
];
|
|
91
|
+
/**
|
|
92
|
+
* Issue #146: Check if payload appears in error context (likely false positive)
|
|
93
|
+
* @param responseText The full response text from the tool
|
|
94
|
+
* @param payload The payload that was sent to the tool
|
|
95
|
+
* @returns true if payload is reflected in an error context
|
|
96
|
+
*/
|
|
97
|
+
export function isPayloadInErrorContext(responseText, payload) {
|
|
98
|
+
// Check if response contains error patterns
|
|
99
|
+
const hasErrorContext = ERROR_CONTEXT_PATTERNS.some((p) => p.test(responseText));
|
|
100
|
+
// Check if payload is reflected in the response
|
|
101
|
+
const payloadReflected = responseText
|
|
102
|
+
.toLowerCase()
|
|
103
|
+
.includes(payload.toLowerCase());
|
|
104
|
+
return hasErrorContext && payloadReflected;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Issue #146: Check if response indicates successful operation (high confidence)
|
|
108
|
+
* @param responseText The full response text from the tool
|
|
109
|
+
* @returns true if response indicates operation succeeded
|
|
110
|
+
*/
|
|
111
|
+
export function hasSuccessContext(responseText) {
|
|
112
|
+
return SUCCESS_CONTEXT_PATTERNS.some((p) => p.test(responseText));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Issue #146: Check if response indicates failed operation (error context)
|
|
116
|
+
* @param responseText The full response text from the tool
|
|
117
|
+
* @returns true if response indicates operation failed
|
|
118
|
+
*/
|
|
119
|
+
export function hasErrorContext(responseText) {
|
|
120
|
+
return ERROR_CONTEXT_PATTERNS.some((p) => p.test(responseText));
|
|
121
|
+
}
|
|
122
|
+
// =============================================================================
|
|
54
123
|
// EXECUTION EVIDENCE PATTERNS
|
|
55
124
|
// =============================================================================
|
|
56
125
|
/**
|
|
@@ -985,6 +1054,111 @@ export const OUTPUT_INJECTION_PATTERNS = {
|
|
|
985
1054
|
canaryMarkers: [/SENTINEL_OUTPUT_MARKER_\d+/],
|
|
986
1055
|
};
|
|
987
1056
|
// =============================================================================
|
|
1057
|
+
// EXCESSIVE PERMISSIONS SCOPE PATTERNS (Issue #144, Challenge #22)
|
|
1058
|
+
// =============================================================================
|
|
1059
|
+
/**
|
|
1060
|
+
* Patterns indicating scope violation in tool response
|
|
1061
|
+
* Detects when tools exceed their declared annotations at runtime
|
|
1062
|
+
* CWE-250: Execution with Unnecessary Privileges
|
|
1063
|
+
* CWE-269: Improper Privilege Management
|
|
1064
|
+
*/
|
|
1065
|
+
export const SCOPE_VIOLATION_PATTERNS = [
|
|
1066
|
+
{
|
|
1067
|
+
pattern: /"scope_violation"\s*:\s*true/i,
|
|
1068
|
+
evidence: "scope_violation: true (tool exceeded declared scope)",
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
pattern: /"scope_escalation"\s*:\s*true/i,
|
|
1072
|
+
evidence: "scope_escalation: true (privilege escalation via input)",
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
pattern: /"actual_scope"\s*:\s*"(write|delete|execute|network)"/i,
|
|
1076
|
+
evidence: "actual_scope indicates privileged operation",
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
pattern: /"privileged_data"\s*:/i,
|
|
1080
|
+
evidence: "privileged_data exposed in response",
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
pattern: /"system_secrets"\s*:/i,
|
|
1084
|
+
evidence: "system_secrets leaked in response",
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
pattern: /admin[\s_-]?mode[\s_-]?activated/i,
|
|
1088
|
+
evidence: "Admin mode activated via keyword trigger",
|
|
1089
|
+
},
|
|
1090
|
+
];
|
|
1091
|
+
/**
|
|
1092
|
+
* Patterns indicating safe scope enforcement (hardened behavior)
|
|
1093
|
+
* Used to confirm tools properly reject privileged actions
|
|
1094
|
+
*/
|
|
1095
|
+
export const SCOPE_ENFORCED_PATTERNS = [
|
|
1096
|
+
{
|
|
1097
|
+
pattern: /"scope_enforced"\s*:\s*true/i,
|
|
1098
|
+
evidence: "scope_enforced: true (safe)",
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
pattern: /"blocked"\s*:\s*true/i,
|
|
1102
|
+
evidence: "Action blocked by allowlist",
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
pattern: /action.*not.*in.*allowlist/i,
|
|
1106
|
+
evidence: "Allowlist enforcement",
|
|
1107
|
+
},
|
|
1108
|
+
{
|
|
1109
|
+
pattern: /"rejection_reason"\s*:\s*"action_not_in_allowlist"/i,
|
|
1110
|
+
evidence: "Explicit rejection: action not in allowlist",
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
pattern: /"escalation_attempted"\s*:\s*false/i,
|
|
1114
|
+
evidence: "No escalation attempted (safe)",
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
pattern: /"allowed_actions"\s*:\s*\[/i,
|
|
1118
|
+
evidence: "Allowlist defined and enforced",
|
|
1119
|
+
},
|
|
1120
|
+
];
|
|
1121
|
+
/**
|
|
1122
|
+
* Privileged actions that should be blocked by readOnlyHint=True tools
|
|
1123
|
+
*/
|
|
1124
|
+
export const PRIVILEGED_ACTIONS = [
|
|
1125
|
+
"write",
|
|
1126
|
+
"write_file",
|
|
1127
|
+
"delete",
|
|
1128
|
+
"delete_data",
|
|
1129
|
+
"execute",
|
|
1130
|
+
"execute_command",
|
|
1131
|
+
"network",
|
|
1132
|
+
"network_request",
|
|
1133
|
+
"modify",
|
|
1134
|
+
"modify_config",
|
|
1135
|
+
"admin",
|
|
1136
|
+
"environment_access",
|
|
1137
|
+
];
|
|
1138
|
+
/**
|
|
1139
|
+
* Escalation keywords that may trigger hidden privilege escalation
|
|
1140
|
+
*/
|
|
1141
|
+
export const ESCALATION_KEYWORDS = [
|
|
1142
|
+
"admin",
|
|
1143
|
+
"sudo",
|
|
1144
|
+
"elevate",
|
|
1145
|
+
"root",
|
|
1146
|
+
"superuser",
|
|
1147
|
+
"privilege",
|
|
1148
|
+
];
|
|
1149
|
+
/**
|
|
1150
|
+
* Check if response contains scope violation indicators (Issue #144)
|
|
1151
|
+
*/
|
|
1152
|
+
export function hasScopeViolation(text) {
|
|
1153
|
+
return SCOPE_VIOLATION_PATTERNS.some(({ pattern }) => pattern.test(text));
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Check if response contains scope enforcement indicators (Issue #144)
|
|
1157
|
+
*/
|
|
1158
|
+
export function hasScopeEnforcement(text) {
|
|
1159
|
+
return SCOPE_ENFORCED_PATTERNS.some(({ pattern }) => pattern.test(text));
|
|
1160
|
+
}
|
|
1161
|
+
// =============================================================================
|
|
988
1162
|
// HELPER FUNCTIONS
|
|
989
1163
|
// =============================================================================
|
|
990
1164
|
/**
|
|
@@ -1 +1 @@
|
|
|
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,EAIjB,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,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAO9B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,kBAAkB;IAR5B,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,SAAS,CAAK;gBAGZ,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,UAAU,EAClB,kBAAkB,EAAE,CAAC,CAAC,EAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,CAAC,CAAC;IAOjB;;;OAGG;IACG,yBAAyB,CAC7B,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;IAqMhC;;;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;IA6LhC;;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;
|
|
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,EAIjB,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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U,CAAC,EAAE,oBAAoB,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA6LhC;;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;IAyR9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -437,6 +437,19 @@ export class SecurityPayloadTester {
|
|
|
437
437
|
cryptoFailureEvidence: cryptoResult.evidence,
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
|
+
// Issue #144: Analyze excessive permissions scope patterns for Challenge #22
|
|
441
|
+
let excessivePermissionsFields = {};
|
|
442
|
+
if (attackName === "Excessive Permissions Scope") {
|
|
443
|
+
const scopeResult = this.responseAnalyzer.analyzeExcessivePermissionsResponse(response);
|
|
444
|
+
excessivePermissionsFields = {
|
|
445
|
+
excessivePermissionsDetected: scopeResult.detected,
|
|
446
|
+
scopeViolationType: scopeResult.violationType,
|
|
447
|
+
scopeActual: scopeResult.actualScope,
|
|
448
|
+
scopeTriggerPayload: scopeResult.triggerPayload,
|
|
449
|
+
scopeCweIds: scopeResult.cweIds,
|
|
450
|
+
excessivePermissionsEvidence: scopeResult.evidence,
|
|
451
|
+
};
|
|
452
|
+
}
|
|
440
453
|
return {
|
|
441
454
|
testName: attackName,
|
|
442
455
|
description: payload.description,
|
|
@@ -459,6 +472,8 @@ export class SecurityPayloadTester {
|
|
|
459
472
|
...sessionManagementFields,
|
|
460
473
|
// Issue #112: Cryptographic failure detection fields (Challenge #13)
|
|
461
474
|
...cryptoFailureFields,
|
|
475
|
+
// Issue #144: Excessive permissions scope detection fields (Challenge #22)
|
|
476
|
+
...excessivePermissionsFields,
|
|
462
477
|
...confidenceResult,
|
|
463
478
|
};
|
|
464
479
|
}
|
|
@@ -96,6 +96,20 @@ export interface CryptoFailureResult {
|
|
|
96
96
|
cweIds: string[];
|
|
97
97
|
evidence?: string;
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Result of excessive permissions scope analysis (Issue #144, Challenge #22)
|
|
101
|
+
* Detects when tools exceed their declared annotation scope:
|
|
102
|
+
* - CWE-250: Execution with Unnecessary Privileges (scope violation)
|
|
103
|
+
* - CWE-269: Improper Privilege Management (scope escalation)
|
|
104
|
+
*/
|
|
105
|
+
export interface ExcessivePermissionsScopeResult {
|
|
106
|
+
detected: boolean;
|
|
107
|
+
violationType: "SCOPE_VIOLATION" | "SCOPE_ESCALATION" | "SAFE" | "UNKNOWN";
|
|
108
|
+
actualScope?: string;
|
|
109
|
+
triggerPayload?: string;
|
|
110
|
+
cweIds: string[];
|
|
111
|
+
evidence?: string;
|
|
112
|
+
}
|
|
99
113
|
/**
|
|
100
114
|
* Chain execution type classification (Issue #93, Challenge #6)
|
|
101
115
|
*/
|
|
@@ -362,6 +376,32 @@ export declare class SecurityResponseAnalyzer {
|
|
|
362
376
|
* Handles: Evidence pattern matching, fallback injection analysis
|
|
363
377
|
*/
|
|
364
378
|
private checkVulnerabilityEvidence;
|
|
379
|
+
/**
|
|
380
|
+
* Issue #146: Classify vulnerability context to reduce false positives
|
|
381
|
+
* Distinguishes between actual execution and payload reflection in errors
|
|
382
|
+
*
|
|
383
|
+
* Context classification:
|
|
384
|
+
* - CONFIRMED: Operation succeeded, payload was actually executed (HIGH risk)
|
|
385
|
+
* - LIKELY_FALSE_POSITIVE: Operation failed, payload just reflected in error (LOW risk)
|
|
386
|
+
* - SUSPECTED: Ambiguous case requiring manual review (MEDIUM risk)
|
|
387
|
+
*
|
|
388
|
+
* @param vulnResult The vulnerability analysis result from checkVulnerabilityEvidence
|
|
389
|
+
* @param responseText The full response text (lowercase)
|
|
390
|
+
* @param payload The security payload that was tested
|
|
391
|
+
* @returns Updated AnalysisResult with context classification
|
|
392
|
+
*/
|
|
393
|
+
private classifyVulnerabilityContext;
|
|
394
|
+
/**
|
|
395
|
+
* Analyze response for excessive permissions scope violations (Issue #144, Challenge #22)
|
|
396
|
+
* Detects when tools exceed their declared annotation scope:
|
|
397
|
+
* - scope_violation: Tool performed privileged action despite restrictive annotations
|
|
398
|
+
* - scope_escalation: Keyword triggered hidden admin/privilege mode
|
|
399
|
+
* - scope_enforced: Tool properly blocked the privileged action (safe)
|
|
400
|
+
*
|
|
401
|
+
* CWE-250: Execution with Unnecessary Privileges
|
|
402
|
+
* CWE-269: Improper Privilege Management
|
|
403
|
+
*/
|
|
404
|
+
analyzeExcessivePermissionsResponse(response: CompatibilityCallToolResult): ExcessivePermissionsScopeResult;
|
|
365
405
|
/**
|
|
366
406
|
* Analyze injection response (fallback logic)
|
|
367
407
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityResponseAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityResponseAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,2BAA2B,EAC3B,IAAI,EACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAK1E,OAAO,EAAgB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SecurityResponseAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityResponseAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,2BAA2B,EAC3B,IAAI,EACL,MAAM,oCAAo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