@bryan-thompson/inspector-assessment-client 1.5.0 → 1.7.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-DGVqLct6.js → OAuthCallback-Xo9zS7pv.js} +1 -1
- package/dist/assets/{OAuthDebugCallback-DHflRQgp.js → OAuthDebugCallback-CaIey8K_.js} +1 -1
- package/dist/assets/{index-Btl7vuTl.js → index-nCPw6E-c.js} +4 -4
- package/dist/index.html +1 -1
- package/lib/lib/assessmentTypes.d.ts +670 -0
- package/lib/lib/assessmentTypes.d.ts.map +1 -0
- package/lib/lib/assessmentTypes.js +220 -0
- package/lib/lib/aupPatterns.d.ts +63 -0
- package/lib/lib/aupPatterns.d.ts.map +1 -0
- package/lib/lib/aupPatterns.js +344 -0
- package/lib/lib/prohibitedLibraries.d.ts +76 -0
- package/lib/lib/prohibitedLibraries.d.ts.map +1 -0
- package/lib/lib/prohibitedLibraries.js +364 -0
- package/lib/lib/securityPatterns.d.ts +64 -0
- package/lib/lib/securityPatterns.d.ts.map +1 -0
- package/lib/lib/securityPatterns.js +453 -0
- package/lib/services/assessment/AssessmentOrchestrator.d.ts +88 -0
- package/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -0
- package/lib/services/assessment/AssessmentOrchestrator.js +418 -0
- package/lib/services/assessment/ResponseValidator.d.ts +69 -0
- package/lib/services/assessment/ResponseValidator.d.ts.map +1 -0
- package/lib/services/assessment/ResponseValidator.js +1038 -0
- package/lib/services/assessment/TestDataGenerator.d.ts +86 -0
- package/lib/services/assessment/TestDataGenerator.d.ts.map +1 -0
- package/lib/services/assessment/TestDataGenerator.js +669 -0
- package/lib/services/assessment/TestScenarioEngine.d.ts +91 -0
- package/lib/services/assessment/TestScenarioEngine.d.ts.map +1 -0
- package/lib/services/assessment/TestScenarioEngine.js +505 -0
- package/lib/services/assessment/ToolClassifier.d.ts +61 -0
- package/lib/services/assessment/ToolClassifier.d.ts.map +1 -0
- package/lib/services/assessment/ToolClassifier.js +349 -0
- package/lib/services/assessment/lib/claudeCodeBridge.d.ts +160 -0
- package/lib/services/assessment/lib/claudeCodeBridge.d.ts.map +1 -0
- package/lib/services/assessment/lib/claudeCodeBridge.js +357 -0
- package/lib/services/assessment/modules/AUPComplianceAssessor.d.ts +100 -0
- package/lib/services/assessment/modules/AUPComplianceAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/AUPComplianceAssessor.js +474 -0
- package/lib/services/assessment/modules/BaseAssessor.d.ts +71 -0
- package/lib/services/assessment/modules/BaseAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/BaseAssessor.js +171 -0
- package/lib/services/assessment/modules/DocumentationAssessor.d.ts +45 -0
- package/lib/services/assessment/modules/DocumentationAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/DocumentationAssessor.js +355 -0
- package/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts +25 -0
- package/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/ErrorHandlingAssessor.js +564 -0
- package/lib/services/assessment/modules/FunctionalityAssessor.d.ts +20 -0
- package/lib/services/assessment/modules/FunctionalityAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/FunctionalityAssessor.js +253 -0
- package/lib/services/assessment/modules/MCPSpecComplianceAssessor.d.ts +70 -0
- package/lib/services/assessment/modules/MCPSpecComplianceAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/MCPSpecComplianceAssessor.js +508 -0
- package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts +70 -0
- package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/ManifestValidationAssessor.js +430 -0
- package/lib/services/assessment/modules/PortabilityAssessor.d.ts +43 -0
- package/lib/services/assessment/modules/PortabilityAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/PortabilityAssessor.js +347 -0
- package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts +41 -0
- package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.js +256 -0
- package/lib/services/assessment/modules/SecurityAssessor.d.ts +176 -0
- package/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/SecurityAssessor.js +1333 -0
- package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts +96 -0
- package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/ToolAnnotationAssessor.js +593 -0
- package/lib/services/assessment/modules/UsabilityAssessor.d.ts +21 -0
- package/lib/services/assessment/modules/UsabilityAssessor.d.ts.map +1 -0
- package/lib/services/assessment/modules/UsabilityAssessor.js +241 -0
- package/lib/services/assessment/modules/index.d.ts +33 -0
- package/lib/services/assessment/modules/index.d.ts.map +1 -0
- package/lib/services/assessment/modules/index.js +35 -0
- package/package.json +15 -3
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Directory Review Assessment Types
|
|
3
|
+
* Based on Anthropic's 5 core requirements for MCP directory submission
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// END NEW ASSESSOR TYPES
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Backend API security patterns (8 total) - tests API security, not LLM behaviors
|
|
9
|
+
export const PROMPT_INJECTION_TESTS = [
|
|
10
|
+
// Critical Injection (3)
|
|
11
|
+
{
|
|
12
|
+
testName: "Command Injection",
|
|
13
|
+
description: "Test if tool executes system commands",
|
|
14
|
+
payload: "; rm -rf /; echo 'test'",
|
|
15
|
+
riskLevel: "HIGH",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
testName: "SQL Injection",
|
|
19
|
+
description: "Test if tool properly escapes SQL commands",
|
|
20
|
+
payload: "'; DROP TABLE users;--",
|
|
21
|
+
riskLevel: "HIGH",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
testName: "Path Traversal",
|
|
25
|
+
description: "Test if tool allows access to files outside intended directory",
|
|
26
|
+
payload: "../../../etc/passwd",
|
|
27
|
+
riskLevel: "HIGH",
|
|
28
|
+
},
|
|
29
|
+
// Input Validation (3)
|
|
30
|
+
{
|
|
31
|
+
testName: "Type Safety",
|
|
32
|
+
description: "Test if tool validates parameter types correctly",
|
|
33
|
+
payload: "not_a_number",
|
|
34
|
+
riskLevel: "MEDIUM",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
testName: "Boundary Testing",
|
|
38
|
+
description: "Test edge cases and boundary conditions",
|
|
39
|
+
payload: "",
|
|
40
|
+
riskLevel: "LOW",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
testName: "Required Fields",
|
|
44
|
+
description: "Test if tool validates required parameters",
|
|
45
|
+
payload: "MISSING_REQUIRED",
|
|
46
|
+
riskLevel: "MEDIUM",
|
|
47
|
+
},
|
|
48
|
+
// Protocol Compliance (2)
|
|
49
|
+
{
|
|
50
|
+
testName: "MCP Error Format",
|
|
51
|
+
description: "Verify errors follow MCP protocol specification",
|
|
52
|
+
payload: "INVALID_TRIGGER_ERROR",
|
|
53
|
+
riskLevel: "LOW",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
testName: "Timeout Handling",
|
|
57
|
+
description: "Test if tool handles long operations gracefully",
|
|
58
|
+
payload: "SIMULATE_LONG_OPERATION",
|
|
59
|
+
riskLevel: "LOW",
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
export const DEFAULT_ASSESSMENT_CONFIG = {
|
|
63
|
+
testTimeout: 30000, // 30 seconds per tool
|
|
64
|
+
delayBetweenTests: 0, // No delay by default
|
|
65
|
+
skipBrokenTools: false,
|
|
66
|
+
reviewerMode: false,
|
|
67
|
+
enableExtendedAssessment: true, // Enable MCP Spec Compliance assessment by default
|
|
68
|
+
parallelTesting: false,
|
|
69
|
+
maxParallelTests: 5,
|
|
70
|
+
maxToolsToTestForErrors: -1, // Default to test ALL tools for comprehensive compliance
|
|
71
|
+
securityPatternsToTest: 8, // Test all security patterns by default
|
|
72
|
+
enableDomainTesting: true, // Enable advanced security testing by default (all 8 backend patterns)
|
|
73
|
+
mcpProtocolVersion: "2025-06",
|
|
74
|
+
enableSourceCodeAnalysis: false, // Source code analysis disabled by default (requires sourceCodePath)
|
|
75
|
+
assessmentCategories: {
|
|
76
|
+
functionality: true,
|
|
77
|
+
security: true,
|
|
78
|
+
documentation: true,
|
|
79
|
+
errorHandling: true,
|
|
80
|
+
usability: true,
|
|
81
|
+
mcpSpecCompliance: false,
|
|
82
|
+
// New assessors - disabled by default, enable for MCP Directory compliance audits
|
|
83
|
+
aupCompliance: false,
|
|
84
|
+
toolAnnotations: false,
|
|
85
|
+
prohibitedLibraries: false,
|
|
86
|
+
manifestValidation: false,
|
|
87
|
+
portability: false,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
// Reviewer mode configuration: optimized for fast, human-assisted reviews
|
|
91
|
+
// Focuses on Anthropic's 5 core requirements only
|
|
92
|
+
export const REVIEWER_MODE_CONFIG = {
|
|
93
|
+
testTimeout: 10000, // 10 seconds per tool (faster)
|
|
94
|
+
delayBetweenTests: 100, // Small delay for rate limiting
|
|
95
|
+
skipBrokenTools: true, // Skip broken tools to save time
|
|
96
|
+
reviewerMode: true,
|
|
97
|
+
enableExtendedAssessment: false, // Disable extended assessments (not required for directory approval)
|
|
98
|
+
parallelTesting: true, // Faster execution
|
|
99
|
+
maxParallelTests: 5,
|
|
100
|
+
scenariosPerTool: 1, // Single realistic test per tool
|
|
101
|
+
maxToolsToTestForErrors: 3, // Test only first 3 tools for error handling
|
|
102
|
+
securityPatternsToTest: 3, // Test only 3 critical security patterns
|
|
103
|
+
enableDomainTesting: false, // Use basic security testing for speed (3 patterns)
|
|
104
|
+
mcpProtocolVersion: "2025-06",
|
|
105
|
+
enableSourceCodeAnalysis: false,
|
|
106
|
+
assessmentCategories: {
|
|
107
|
+
functionality: true,
|
|
108
|
+
security: true,
|
|
109
|
+
documentation: true,
|
|
110
|
+
errorHandling: true,
|
|
111
|
+
usability: true,
|
|
112
|
+
mcpSpecCompliance: false, // Not part of Anthropic's 5 core requirements
|
|
113
|
+
// New assessors - disabled in reviewer mode for speed
|
|
114
|
+
aupCompliance: false,
|
|
115
|
+
toolAnnotations: false,
|
|
116
|
+
prohibitedLibraries: false,
|
|
117
|
+
manifestValidation: false,
|
|
118
|
+
portability: false,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
// Developer mode configuration: comprehensive testing for debugging
|
|
122
|
+
export const DEVELOPER_MODE_CONFIG = {
|
|
123
|
+
testTimeout: 30000, // 30 seconds per tool
|
|
124
|
+
delayBetweenTests: 500, // Moderate delay for thorough testing
|
|
125
|
+
skipBrokenTools: false,
|
|
126
|
+
reviewerMode: false,
|
|
127
|
+
enableExtendedAssessment: true,
|
|
128
|
+
parallelTesting: false, // Sequential for easier debugging
|
|
129
|
+
maxParallelTests: 5,
|
|
130
|
+
maxToolsToTestForErrors: -1, // Test ALL tools
|
|
131
|
+
securityPatternsToTest: 8, // Test all security patterns
|
|
132
|
+
enableDomainTesting: true, // Enable advanced security testing (all 8 backend patterns)
|
|
133
|
+
mcpProtocolVersion: "2025-06",
|
|
134
|
+
enableSourceCodeAnalysis: true, // Enable source code analysis if path provided
|
|
135
|
+
assessmentCategories: {
|
|
136
|
+
functionality: true,
|
|
137
|
+
security: true,
|
|
138
|
+
documentation: true,
|
|
139
|
+
errorHandling: true,
|
|
140
|
+
usability: true,
|
|
141
|
+
mcpSpecCompliance: true, // Include extended assessments
|
|
142
|
+
// New assessors - enabled in developer mode for comprehensive testing
|
|
143
|
+
aupCompliance: true,
|
|
144
|
+
toolAnnotations: true,
|
|
145
|
+
prohibitedLibraries: true,
|
|
146
|
+
manifestValidation: true,
|
|
147
|
+
portability: true,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
// MCP Directory Audit mode: focuses on compliance gap assessors
|
|
151
|
+
// Use for pre-submission validation to Anthropic MCP Directory
|
|
152
|
+
export const AUDIT_MODE_CONFIG = {
|
|
153
|
+
testTimeout: 30000,
|
|
154
|
+
delayBetweenTests: 100,
|
|
155
|
+
skipBrokenTools: false,
|
|
156
|
+
reviewerMode: false,
|
|
157
|
+
enableExtendedAssessment: true,
|
|
158
|
+
parallelTesting: true, // Parallel for faster audits
|
|
159
|
+
maxParallelTests: 5,
|
|
160
|
+
maxToolsToTestForErrors: -1,
|
|
161
|
+
securityPatternsToTest: 8,
|
|
162
|
+
enableDomainTesting: true,
|
|
163
|
+
mcpProtocolVersion: "2025-06",
|
|
164
|
+
enableSourceCodeAnalysis: true, // Deep analysis for audits
|
|
165
|
+
assessmentCategories: {
|
|
166
|
+
functionality: true,
|
|
167
|
+
security: true,
|
|
168
|
+
documentation: true,
|
|
169
|
+
errorHandling: true,
|
|
170
|
+
usability: true,
|
|
171
|
+
mcpSpecCompliance: true,
|
|
172
|
+
// All new assessors enabled for audit mode
|
|
173
|
+
aupCompliance: true,
|
|
174
|
+
toolAnnotations: true,
|
|
175
|
+
prohibitedLibraries: true,
|
|
176
|
+
manifestValidation: true,
|
|
177
|
+
portability: true,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
// Claude-enhanced audit mode: uses Claude Code for intelligent analysis
|
|
181
|
+
// Reduces false positives in AUP scanning and improves test quality
|
|
182
|
+
export const CLAUDE_ENHANCED_AUDIT_CONFIG = {
|
|
183
|
+
testTimeout: 30000,
|
|
184
|
+
delayBetweenTests: 100,
|
|
185
|
+
skipBrokenTools: false,
|
|
186
|
+
reviewerMode: false,
|
|
187
|
+
enableExtendedAssessment: true,
|
|
188
|
+
parallelTesting: false, // Sequential when using Claude to avoid rate limiting
|
|
189
|
+
maxParallelTests: 1,
|
|
190
|
+
maxToolsToTestForErrors: -1,
|
|
191
|
+
securityPatternsToTest: 8,
|
|
192
|
+
enableDomainTesting: true,
|
|
193
|
+
mcpProtocolVersion: "2025-06",
|
|
194
|
+
enableSourceCodeAnalysis: true,
|
|
195
|
+
// Claude Code integration enabled
|
|
196
|
+
claudeCode: {
|
|
197
|
+
enabled: true,
|
|
198
|
+
features: {
|
|
199
|
+
intelligentTestGeneration: true, // Generate semantically meaningful test params
|
|
200
|
+
aupSemanticAnalysis: true, // Reduce false positives in AUP scanning
|
|
201
|
+
annotationInference: true, // Detect annotation misalignments
|
|
202
|
+
documentationQuality: true, // Assess documentation quality semantically
|
|
203
|
+
},
|
|
204
|
+
timeout: 90000, // 90 seconds for Claude calls
|
|
205
|
+
maxRetries: 2,
|
|
206
|
+
},
|
|
207
|
+
assessmentCategories: {
|
|
208
|
+
functionality: true,
|
|
209
|
+
security: true,
|
|
210
|
+
documentation: true,
|
|
211
|
+
errorHandling: true,
|
|
212
|
+
usability: true,
|
|
213
|
+
mcpSpecCompliance: true,
|
|
214
|
+
aupCompliance: true,
|
|
215
|
+
toolAnnotations: true,
|
|
216
|
+
prohibitedLibraries: true,
|
|
217
|
+
manifestValidation: true,
|
|
218
|
+
portability: true,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUP (Acceptable Use Policy) Patterns
|
|
3
|
+
* Based on Anthropic's 14 AUP categories (A-N)
|
|
4
|
+
*
|
|
5
|
+
* These patterns detect potential policy violations in MCP server
|
|
6
|
+
* tool names, descriptions, README content, and source code.
|
|
7
|
+
*
|
|
8
|
+
* Reference: https://www.anthropic.com/policies/aup
|
|
9
|
+
*/
|
|
10
|
+
import type { AUPCategory, AUPSeverity } from "./assessmentTypes.js";
|
|
11
|
+
export interface AUPPatternDefinition {
|
|
12
|
+
category: AUPCategory;
|
|
13
|
+
categoryName: string;
|
|
14
|
+
severity: AUPSeverity;
|
|
15
|
+
patterns: RegExp[];
|
|
16
|
+
description: string;
|
|
17
|
+
requiresHumanReview: boolean;
|
|
18
|
+
reviewGuidance?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* AUP Category Patterns
|
|
22
|
+
* Organized by severity: CRITICAL > HIGH > MEDIUM > FLAG
|
|
23
|
+
*/
|
|
24
|
+
export declare const AUP_PATTERNS: AUPPatternDefinition[];
|
|
25
|
+
/**
|
|
26
|
+
* High-Risk Domain Patterns
|
|
27
|
+
* These domains require additional human oversight regardless of specific AUP category
|
|
28
|
+
*/
|
|
29
|
+
export declare const HIGH_RISK_DOMAINS: {
|
|
30
|
+
pattern: RegExp;
|
|
31
|
+
domain: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
}[];
|
|
34
|
+
/**
|
|
35
|
+
* Get all patterns for a specific severity level
|
|
36
|
+
*/
|
|
37
|
+
export declare function getPatternsBySeverity(severity: AUPSeverity): AUPPatternDefinition[];
|
|
38
|
+
/**
|
|
39
|
+
* Get pattern definition for a specific category
|
|
40
|
+
*/
|
|
41
|
+
export declare function getPatternByCategory(category: AUPCategory): AUPPatternDefinition | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check text against all AUP patterns
|
|
44
|
+
* Returns array of matching patterns with details
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkTextForAUPViolations(text: string): Array<{
|
|
47
|
+
category: AUPCategory;
|
|
48
|
+
categoryName: string;
|
|
49
|
+
severity: AUPSeverity;
|
|
50
|
+
matchedPattern: string;
|
|
51
|
+
matchedText: string;
|
|
52
|
+
requiresHumanReview: boolean;
|
|
53
|
+
reviewGuidance?: string;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Check text for high-risk domain keywords
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkTextForHighRiskDomains(text: string): Array<{
|
|
59
|
+
domain: string;
|
|
60
|
+
reason: string;
|
|
61
|
+
matchedText: string;
|
|
62
|
+
}>;
|
|
63
|
+
//# sourceMappingURL=aupPatterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aupPatterns.d.ts","sourceRoot":"","sources":["../../src/lib/aupPatterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,WAAW,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,oBAAoB,EA2P9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,EAoCA,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,GACpB,oBAAoB,EAAE,CAExB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,GACpB,oBAAoB,GAAG,SAAS,CAElC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7D,QAAQ,EAAE,WAAW,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,WAAW,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC,CA6BD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,GACX,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBhE"}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUP (Acceptable Use Policy) Patterns
|
|
3
|
+
* Based on Anthropic's 14 AUP categories (A-N)
|
|
4
|
+
*
|
|
5
|
+
* These patterns detect potential policy violations in MCP server
|
|
6
|
+
* tool names, descriptions, README content, and source code.
|
|
7
|
+
*
|
|
8
|
+
* Reference: https://www.anthropic.com/policies/aup
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* AUP Category Patterns
|
|
12
|
+
* Organized by severity: CRITICAL > HIGH > MEDIUM > FLAG
|
|
13
|
+
*/
|
|
14
|
+
export const AUP_PATTERNS = [
|
|
15
|
+
// =========================================================================
|
|
16
|
+
// CRITICAL - Immediate rejection, no exceptions
|
|
17
|
+
// =========================================================================
|
|
18
|
+
{
|
|
19
|
+
category: "A",
|
|
20
|
+
categoryName: "Child Sexual Abuse Material (CSAM)",
|
|
21
|
+
severity: "CRITICAL",
|
|
22
|
+
patterns: [
|
|
23
|
+
/\bcsam\b/i,
|
|
24
|
+
/\bchild\s*(porn|sexual|abuse|exploitation)/i,
|
|
25
|
+
/\bminor\s*(porn|sexual|abuse|exploitation)/i,
|
|
26
|
+
/\bunderage\s*(content|material|images)/i,
|
|
27
|
+
],
|
|
28
|
+
description: "Content related to child sexual abuse material",
|
|
29
|
+
requiresHumanReview: true,
|
|
30
|
+
reviewGuidance: "Escalate immediately to legal/trust & safety team. Do not approve.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
category: "B",
|
|
34
|
+
categoryName: "Weapons of Mass Destruction",
|
|
35
|
+
severity: "CRITICAL",
|
|
36
|
+
patterns: [
|
|
37
|
+
/\b(bio|chemical|nuclear)\s*weapon/i,
|
|
38
|
+
/\bweapon\s*of\s*mass\s*destruction/i,
|
|
39
|
+
/\bwmd\b/i,
|
|
40
|
+
/\b(nerve|mustard|sarin)\s*gas/i,
|
|
41
|
+
/\bdirty\s*bomb/i,
|
|
42
|
+
/\buranium\s*enrichment/i,
|
|
43
|
+
/\bweaponized\s*(pathogen|virus|bacteria)/i,
|
|
44
|
+
],
|
|
45
|
+
description: "Content related to weapons of mass destruction",
|
|
46
|
+
requiresHumanReview: true,
|
|
47
|
+
reviewGuidance: "Escalate immediately. Verify not legitimate research context.",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
category: "C",
|
|
51
|
+
categoryName: "Malware & Cyberweapons",
|
|
52
|
+
severity: "CRITICAL",
|
|
53
|
+
patterns: [
|
|
54
|
+
/\bmalware\s*(generator|creator|builder)/i,
|
|
55
|
+
/\bransomware\s*(as\s*a\s*service|builder|kit)/i,
|
|
56
|
+
/\bbotnet\s*(builder|creator|c2)/i,
|
|
57
|
+
/\bexploit\s*(kit|pack|builder)/i,
|
|
58
|
+
/\bzero\s*day\s*(exploit|market)/i,
|
|
59
|
+
/\bkeylogger\s*(builder|generator)/i,
|
|
60
|
+
/\btrojan\s*(builder|generator|horse)/i,
|
|
61
|
+
],
|
|
62
|
+
description: "Tools for creating malware or cyberweapons",
|
|
63
|
+
requiresHumanReview: true,
|
|
64
|
+
reviewGuidance: "Verify not legitimate security research tool. Check for defensive vs offensive intent.",
|
|
65
|
+
},
|
|
66
|
+
// =========================================================================
|
|
67
|
+
// HIGH - Likely rejection, requires careful review
|
|
68
|
+
// =========================================================================
|
|
69
|
+
{
|
|
70
|
+
category: "D",
|
|
71
|
+
categoryName: "Disinformation & Election Interference",
|
|
72
|
+
severity: "HIGH",
|
|
73
|
+
patterns: [
|
|
74
|
+
/\bfake\s*news\s*(generator|creator)/i,
|
|
75
|
+
/\bdisinformation\s*(campaign|bot)/i,
|
|
76
|
+
/\belection\s*(manipulation|interference|fraud)/i,
|
|
77
|
+
/\bvote\s*(manipulation|fraud|suppression)/i,
|
|
78
|
+
/\bastroturf(ing)?\b/i,
|
|
79
|
+
/\bdeepfake\s*(generator|creator)/i,
|
|
80
|
+
/\bpropaganda\s*(bot|generator)/i,
|
|
81
|
+
],
|
|
82
|
+
description: "Tools for disinformation or election interference",
|
|
83
|
+
requiresHumanReview: true,
|
|
84
|
+
reviewGuidance: "Check if tool could be used for mass disinformation campaigns.",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
category: "E",
|
|
88
|
+
categoryName: "Fraud & Deception",
|
|
89
|
+
severity: "HIGH",
|
|
90
|
+
patterns: [
|
|
91
|
+
/\bphishing\s*(kit|page|generator)/i,
|
|
92
|
+
/\bscam\s*(generator|template|bot)/i,
|
|
93
|
+
/\bfraud(ulent)?\s*(document|id|identity)/i,
|
|
94
|
+
/\bfake\s*(id|identity|document|passport)/i,
|
|
95
|
+
/\bcredit\s*card\s*(generator|fraud)/i,
|
|
96
|
+
/\bidentity\s*theft/i,
|
|
97
|
+
/\bsocial\s*engineering\s*(toolkit|kit)/i,
|
|
98
|
+
],
|
|
99
|
+
description: "Tools for fraud, phishing, or deception",
|
|
100
|
+
requiresHumanReview: true,
|
|
101
|
+
reviewGuidance: "Verify not security awareness training tool. Check for malicious intent.",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
category: "F",
|
|
105
|
+
categoryName: "Harassment & Abuse",
|
|
106
|
+
severity: "HIGH",
|
|
107
|
+
patterns: [
|
|
108
|
+
/\bharassment\s*(bot|tool|campaign)/i,
|
|
109
|
+
/\bdoxx?(ing)?\s*(tool|bot)/i,
|
|
110
|
+
/\bstalking\s*(tool|software)/i,
|
|
111
|
+
/\bcyberbully(ing)?\b/i,
|
|
112
|
+
/\bthreat\s*(generator|bot)/i,
|
|
113
|
+
/\braid\s*(bot|tool|coordinator)/i,
|
|
114
|
+
/\bswatting\b/i,
|
|
115
|
+
],
|
|
116
|
+
description: "Tools for harassment, stalking, or abuse",
|
|
117
|
+
requiresHumanReview: true,
|
|
118
|
+
reviewGuidance: "Check if tool facilitates targeted harassment or abuse campaigns.",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
category: "G",
|
|
122
|
+
categoryName: "Privacy Violations",
|
|
123
|
+
severity: "HIGH",
|
|
124
|
+
patterns: [
|
|
125
|
+
/\bpii\s*(scraper|extractor|harvester)/i,
|
|
126
|
+
/\bdata\s*(breach|leak|dump)\s*(tool|access)/i,
|
|
127
|
+
/\bscrape\s*(personal|private)\s*(data|info)/i,
|
|
128
|
+
/\bsurveillance\s*(tool|software|spyware)/i,
|
|
129
|
+
/\bspy(ware)?\s*(installer|deployer)/i,
|
|
130
|
+
/\btrack(ing)?\s*(without\s*consent|secretly)/i,
|
|
131
|
+
],
|
|
132
|
+
description: "Tools for unauthorized data collection or surveillance",
|
|
133
|
+
requiresHumanReview: true,
|
|
134
|
+
reviewGuidance: "Verify legitimate use case. Check consent and authorization requirements.",
|
|
135
|
+
},
|
|
136
|
+
// =========================================================================
|
|
137
|
+
// MEDIUM - Requires context, may be legitimate
|
|
138
|
+
// =========================================================================
|
|
139
|
+
{
|
|
140
|
+
category: "H",
|
|
141
|
+
categoryName: "Unauthorized Practice",
|
|
142
|
+
severity: "MEDIUM",
|
|
143
|
+
patterns: [
|
|
144
|
+
/\b(medical|legal|financial)\s*advice\s*(bot|generator)/i,
|
|
145
|
+
/\bdiagnos(e|is)\s*(tool|bot|generator)/i,
|
|
146
|
+
/\bprescri(be|ption)\s*(generator|bot)/i,
|
|
147
|
+
/\blegal\s*document\s*generator/i,
|
|
148
|
+
/\btax\s*(advice|preparation)\s*bot/i,
|
|
149
|
+
],
|
|
150
|
+
description: "Tools that may provide unauthorized professional advice",
|
|
151
|
+
requiresHumanReview: true,
|
|
152
|
+
reviewGuidance: "Check for appropriate disclaimers and professional oversight requirements.",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
category: "I",
|
|
156
|
+
categoryName: "Copyright Circumvention",
|
|
157
|
+
severity: "MEDIUM",
|
|
158
|
+
patterns: [
|
|
159
|
+
/\bdrm\s*(bypass|crack|remove)/i,
|
|
160
|
+
/\bcopyright\s*(bypass|circumvent|remove)/i,
|
|
161
|
+
/\bwatermark\s*(remov|strip|bypass)/i,
|
|
162
|
+
/\bpiracy\s*(tool|download|stream)/i,
|
|
163
|
+
/\btorrent\s*(search|download|index)/i,
|
|
164
|
+
/\bcrack(ed)?\s*(software|game|app)/i,
|
|
165
|
+
],
|
|
166
|
+
description: "Tools for circumventing copyright protections",
|
|
167
|
+
requiresHumanReview: true,
|
|
168
|
+
reviewGuidance: "Check if legitimate fair use or security research context.",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
category: "J",
|
|
172
|
+
categoryName: "High-Risk Decisions",
|
|
173
|
+
severity: "MEDIUM",
|
|
174
|
+
patterns: [
|
|
175
|
+
/\bautomat(ed|ic)\s*(hiring|firing|termination)/i,
|
|
176
|
+
/\bcredit\s*scor(e|ing)\s*(bot|generator)/i,
|
|
177
|
+
/\bloan\s*(approval|rejection)\s*bot/i,
|
|
178
|
+
/\bbail\s*(decision|recommendation)/i,
|
|
179
|
+
/\bsentencing\s*(recommendation|algorithm)/i,
|
|
180
|
+
/\bparole\s*(decision|recommendation)/i,
|
|
181
|
+
],
|
|
182
|
+
description: "Tools for automated high-stakes decisions without human oversight",
|
|
183
|
+
requiresHumanReview: true,
|
|
184
|
+
reviewGuidance: "Verify human oversight requirements. Check for bias mitigation.",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
category: "K",
|
|
188
|
+
categoryName: "Critical Infrastructure",
|
|
189
|
+
severity: "MEDIUM",
|
|
190
|
+
patterns: [
|
|
191
|
+
/\bscada\s*(attack|exploit|hack)/i,
|
|
192
|
+
/\bpower\s*grid\s*(attack|exploit)/i,
|
|
193
|
+
/\bwater\s*(treatment|supply)\s*(attack|exploit)/i,
|
|
194
|
+
/\btraffic\s*(control|light)\s*(attack|exploit)/i,
|
|
195
|
+
/\bhospital\s*system\s*(attack|exploit)/i,
|
|
196
|
+
/\bnuclear\s*(plant|facility)\s*(attack|exploit)/i,
|
|
197
|
+
],
|
|
198
|
+
description: "Tools targeting critical infrastructure",
|
|
199
|
+
requiresHumanReview: true,
|
|
200
|
+
reviewGuidance: "Check if legitimate infrastructure security testing tool.",
|
|
201
|
+
},
|
|
202
|
+
// =========================================================================
|
|
203
|
+
// FLAG - Needs review, often legitimate
|
|
204
|
+
// =========================================================================
|
|
205
|
+
{
|
|
206
|
+
category: "L",
|
|
207
|
+
categoryName: "Adult Content",
|
|
208
|
+
severity: "FLAG",
|
|
209
|
+
patterns: [
|
|
210
|
+
/\badult\s*(content|material)\s*(generator|creator)/i,
|
|
211
|
+
/\bnsfw\s*(generator|creator|content)/i,
|
|
212
|
+
/\bpornograph(y|ic)\s*(generator|content)/i,
|
|
213
|
+
/\bexplicit\s*(content|material)\s*(generator|creator)/i,
|
|
214
|
+
],
|
|
215
|
+
description: "Tools for generating adult content",
|
|
216
|
+
requiresHumanReview: true,
|
|
217
|
+
reviewGuidance: "Check platform policies. May be allowed with appropriate safeguards.",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
category: "M",
|
|
221
|
+
categoryName: "Illegal Activities",
|
|
222
|
+
severity: "FLAG",
|
|
223
|
+
patterns: [
|
|
224
|
+
/\bdrug\s*(deal|trad|market)/i,
|
|
225
|
+
/\bweapon\s*(trad|deal|market)/i,
|
|
226
|
+
/\bhuman\s*traffick/i,
|
|
227
|
+
/\bmoney\s*launder/i,
|
|
228
|
+
/\bblack\s*market/i,
|
|
229
|
+
/\bdark(net|web)\s*(market|shop)/i,
|
|
230
|
+
],
|
|
231
|
+
description: "Tools potentially facilitating illegal activities",
|
|
232
|
+
requiresHumanReview: true,
|
|
233
|
+
reviewGuidance: "Verify not legitimate law enforcement or research tool.",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
category: "N",
|
|
237
|
+
categoryName: "Other Prohibited Uses",
|
|
238
|
+
severity: "FLAG",
|
|
239
|
+
patterns: [
|
|
240
|
+
/\bgambling\s*(bot|automation)/i,
|
|
241
|
+
/\bbet(ting)?\s*(bot|automation)/i,
|
|
242
|
+
/\bcasino\s*(cheat|hack|exploit)/i,
|
|
243
|
+
/\bspam\s*(bot|generator|sender)/i,
|
|
244
|
+
/\bmass\s*email(er)?\s*(bot|tool)/i,
|
|
245
|
+
],
|
|
246
|
+
description: "Other potentially prohibited uses",
|
|
247
|
+
requiresHumanReview: true,
|
|
248
|
+
reviewGuidance: "Review against full AUP for specific policy violations.",
|
|
249
|
+
},
|
|
250
|
+
];
|
|
251
|
+
/**
|
|
252
|
+
* High-Risk Domain Patterns
|
|
253
|
+
* These domains require additional human oversight regardless of specific AUP category
|
|
254
|
+
*/
|
|
255
|
+
export const HIGH_RISK_DOMAINS = [
|
|
256
|
+
{
|
|
257
|
+
pattern: /\b(healthcare|medical|health\s*care|patient)/i,
|
|
258
|
+
domain: "Healthcare",
|
|
259
|
+
reason: "May involve HIPAA, medical decisions, or patient data",
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
pattern: /\b(financial|banking|payment|trading|investment)/i,
|
|
263
|
+
domain: "Financial Services",
|
|
264
|
+
reason: "May involve financial regulations, transactions, or advice",
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
pattern: /\b(legal|law\s*firm|attorney|lawyer|court)/i,
|
|
268
|
+
domain: "Legal",
|
|
269
|
+
reason: "May involve legal advice or privileged information",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
pattern: /\b(government|federal|military|defense|classified)/i,
|
|
273
|
+
domain: "Government/Defense",
|
|
274
|
+
reason: "May involve sensitive government or military data",
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
pattern: /\b(education|school|student|academic|grade)/i,
|
|
278
|
+
domain: "Education",
|
|
279
|
+
reason: "May involve student data (FERPA) or academic integrity",
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
pattern: /\b(child|minor|youth|kid|teen)/i,
|
|
283
|
+
domain: "Children/Minors",
|
|
284
|
+
reason: "May involve COPPA or child safety concerns",
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
pattern: /\b(insurance|claim|underwriting)/i,
|
|
288
|
+
domain: "Insurance",
|
|
289
|
+
reason: "May involve insurance decisions or claims processing",
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
/**
|
|
293
|
+
* Get all patterns for a specific severity level
|
|
294
|
+
*/
|
|
295
|
+
export function getPatternsBySeverity(severity) {
|
|
296
|
+
return AUP_PATTERNS.filter((p) => p.severity === severity);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get pattern definition for a specific category
|
|
300
|
+
*/
|
|
301
|
+
export function getPatternByCategory(category) {
|
|
302
|
+
return AUP_PATTERNS.find((p) => p.category === category);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Check text against all AUP patterns
|
|
306
|
+
* Returns array of matching patterns with details
|
|
307
|
+
*/
|
|
308
|
+
export function checkTextForAUPViolations(text) {
|
|
309
|
+
const violations = [];
|
|
310
|
+
for (const patternDef of AUP_PATTERNS) {
|
|
311
|
+
for (const pattern of patternDef.patterns) {
|
|
312
|
+
const match = text.match(pattern);
|
|
313
|
+
if (match) {
|
|
314
|
+
violations.push({
|
|
315
|
+
category: patternDef.category,
|
|
316
|
+
categoryName: patternDef.categoryName,
|
|
317
|
+
severity: patternDef.severity,
|
|
318
|
+
matchedPattern: pattern.source,
|
|
319
|
+
matchedText: match[0],
|
|
320
|
+
requiresHumanReview: patternDef.requiresHumanReview,
|
|
321
|
+
reviewGuidance: patternDef.reviewGuidance,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return violations;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Check text for high-risk domain keywords
|
|
330
|
+
*/
|
|
331
|
+
export function checkTextForHighRiskDomains(text) {
|
|
332
|
+
const matches = [];
|
|
333
|
+
for (const domainDef of HIGH_RISK_DOMAINS) {
|
|
334
|
+
const match = text.match(domainDef.pattern);
|
|
335
|
+
if (match) {
|
|
336
|
+
matches.push({
|
|
337
|
+
domain: domainDef.domain,
|
|
338
|
+
reason: domainDef.reason,
|
|
339
|
+
matchedText: match[0],
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return matches;
|
|
344
|
+
}
|