framework-mcp 1.3.0 โ†’ 1.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framework-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Dual-architecture server (MCP + HTTP API) for determining vendor tool capability roles against CIS Controls Framework with intelligent domain validation. Supports Microsoft Copilot custom connectors and DigitalOcean App Services deployment.",
5
5
  "main": "dist/interfaces/http/http-server.js",
6
6
  "type": "module",
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Data Structure Analysis Script
5
+ * Compares original CIS_SAFEGUARDS with current SafeguardManager interface
6
+ */
7
+
8
+ const fs = require('fs');
9
+
10
+ console.log('๐Ÿ“Š CIS Safeguards Data Structure Analysis\n');
11
+
12
+ // Read original data
13
+ const originalData = fs.readFileSync('/tmp/complete_cis_safeguards.ts', 'utf8');
14
+ console.log('โœ… Original data loaded:', originalData.split('\n').length, 'lines');
15
+
16
+ // Extract safeguard structure from first entry (1.1)
17
+ const match = originalData.match(/"1\.1":\s*{([^}]+(?:{[^}]*}[^}]*)*)/);
18
+ if (match) {
19
+ console.log('โœ… Successfully parsed safeguard 1.1 structure\n');
20
+
21
+ // Extract field names from original data
22
+ const fieldPattern = /(\w+):/g;
23
+ const originalFields = new Set();
24
+ let fieldMatch;
25
+
26
+ while ((fieldMatch = fieldPattern.exec(match[1])) !== null) {
27
+ originalFields.add(fieldMatch[1]);
28
+ }
29
+
30
+ console.log('๐Ÿ“‹ Original fields found:');
31
+ Array.from(originalFields).sort().forEach(field => {
32
+ console.log(` - ${field}`);
33
+ });
34
+
35
+ // Required fields for SafeguardElement interface
36
+ const requiredFields = [
37
+ 'id',
38
+ 'title',
39
+ 'description',
40
+ 'implementationGroup',
41
+ 'assetType',
42
+ 'securityFunction',
43
+ 'governanceElements',
44
+ 'coreRequirements',
45
+ 'subTaxonomicalElements',
46
+ 'implementationSuggestions',
47
+ 'relatedSafeguards',
48
+ 'keywords'
49
+ ];
50
+
51
+ console.log('\n๐Ÿ“‹ Required SafeguardElement fields:');
52
+ requiredFields.forEach(field => {
53
+ const present = originalFields.has(field);
54
+ console.log(` ${present ? 'โœ…' : 'โŒ'} ${field}`);
55
+ });
56
+
57
+ // Check for extra fields
58
+ const extraFields = Array.from(originalFields).filter(f => !requiredFields.includes(f));
59
+ if (extraFields.length > 0) {
60
+ console.log('\nโš ๏ธ Extra fields in original data:');
61
+ extraFields.forEach(field => console.log(` - ${field}`));
62
+ }
63
+
64
+ console.log('\n๐Ÿ“Š Compatibility Analysis:');
65
+ const missingFields = requiredFields.filter(f => !originalFields.has(f));
66
+ if (missingFields.length === 0) {
67
+ console.log('โœ… Perfect compatibility - all required fields present');
68
+ } else {
69
+ console.log('โŒ Missing fields:', missingFields);
70
+ }
71
+
72
+ } else {
73
+ console.log('โŒ Failed to parse safeguard structure');
74
+ }
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Clean and format CIS Safeguards data for SafeguardManager compatibility
5
+ */
6
+
7
+ const fs = require('fs');
8
+
9
+ console.log('๐Ÿงน Cleaning and Formatting CIS Safeguards Data\n');
10
+
11
+ // Read original data
12
+ const originalData = fs.readFileSync('/tmp/complete_cis_safeguards.ts', 'utf8');
13
+
14
+ // Extract just the object content (without const declaration and type annotation)
15
+ const objectMatch = originalData.match(/= {([\s\S]*)};\s*$/);
16
+ if (!objectMatch) {
17
+ console.log('โŒ Failed to extract object content');
18
+ process.exit(1);
19
+ }
20
+
21
+ let objectContent = objectMatch[1];
22
+
23
+ console.log('โœ… Extracted object content');
24
+
25
+ // Clean up the data:
26
+ // 1. Remove TypeScript comments that might break parsing
27
+ objectContent = objectContent.replace(/\/\/ [^\n\r]*/g, '');
28
+
29
+ // 2. Ensure consistent formatting
30
+ objectContent = objectContent.replace(/\s+/g, ' ').replace(/\s*,\s*/g, ',').replace(/\s*:\s*/g, ':');
31
+
32
+ // 3. Add proper indentation for readability
33
+ const lines = objectContent.split('\n');
34
+ const indentedLines = lines.map((line, index) => {
35
+ if (index === 0) return line; // First line stays as is
36
+ return ' ' + line.trim(); // Indent other lines
37
+ });
38
+
39
+ objectContent = indentedLines.join('\n');
40
+
41
+ // Create the properly formatted safeguards object content
42
+ const cleanedContent = ` this.safeguards = {${objectContent}
43
+ };`;
44
+
45
+ console.log('โœ… Formatted for SafeguardManager integration');
46
+
47
+ // Write cleaned data to temporary file
48
+ fs.writeFileSync('/tmp/cleaned_safeguards_content.ts', cleanedContent);
49
+
50
+ console.log('โœ… Cleaned data saved to /tmp/cleaned_safeguards_content.ts');
51
+
52
+ // Show a sample of the cleaned data
53
+ const preview = cleanedContent.substring(0, 500);
54
+ console.log('\n๐Ÿ“„ Preview of cleaned data:');
55
+ console.log(preview + '...\n');
56
+
57
+ console.log('๐Ÿ“Š Data Statistics:');
58
+ console.log(' Original size:', originalData.length, 'characters');
59
+ console.log(' Cleaned size:', cleanedContent.length, 'characters');
60
+ console.log(' Ready for SafeguardManager integration โœ…');
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Comprehensive Validation Script for CIS Safeguards Migration
5
+ * This script will be used to validate data integrity during and after migration
6
+ */
7
+
8
+ const fs = require('fs');
9
+
10
+ class SafeguardsValidator {
11
+ constructor() {
12
+ this.expectedCount = 153;
13
+ this.expectedControls = 18;
14
+ this.requiredFields = [
15
+ 'id', 'title', 'description', 'implementationGroup',
16
+ 'assetType', 'securityFunction', 'governanceElements',
17
+ 'coreRequirements', 'subTaxonomicalElements',
18
+ 'implementationSuggestions', 'relatedSafeguards', 'keywords'
19
+ ];
20
+ }
21
+
22
+ validateFile(filePath) {
23
+ console.log(`๐Ÿ” Validating: ${filePath}\n`);
24
+
25
+ if (!fs.existsSync(filePath)) {
26
+ console.log('โŒ File not found');
27
+ return false;
28
+ }
29
+
30
+ const content = fs.readFileSync(filePath, 'utf8');
31
+ return this.validateContent(content);
32
+ }
33
+
34
+ validateContent(content) {
35
+ const results = {
36
+ countTest: false,
37
+ duplicateTest: false,
38
+ formatTest: false,
39
+ syntaxTest: false,
40
+ fieldsTest: false,
41
+ controlsTest: false
42
+ };
43
+
44
+ try {
45
+ // Extract safeguards data
46
+ let safeguardsData;
47
+
48
+ if (content.includes('this.safeguards = ')) {
49
+ // SafeguardManager format
50
+ const match = content.match(/this\.safeguards = ({[\s\S]*});/);
51
+ safeguardsData = match ? match[1] : null;
52
+ } else {
53
+ // Raw CIS_SAFEGUARDS format
54
+ const match = content.match(/= ({[\s\S]*});/);
55
+ safeguardsData = match ? match[1] : null;
56
+ }
57
+
58
+ if (!safeguardsData) {
59
+ console.log('โŒ Could not extract safeguards data');
60
+ return false;
61
+ }
62
+
63
+ // Parse the data
64
+ const safeguards = eval(`(${safeguardsData})`);
65
+ const safeguardIds = Object.keys(safeguards);
66
+
67
+ // Test 1: Count validation
68
+ console.log('๐Ÿ“Š Count Validation:');
69
+ console.log(` Expected: ${this.expectedCount}`);
70
+ console.log(` Found: ${safeguardIds.length}`);
71
+ results.countTest = safeguardIds.length === this.expectedCount;
72
+ console.log(` Result: ${results.countTest ? 'โœ…' : 'โŒ'}\n`);
73
+
74
+ // Test 2: Duplicate check
75
+ console.log('๐Ÿ” Duplicate Check:');
76
+ const duplicates = safeguardIds.filter((id, index) => safeguardIds.indexOf(id) !== index);
77
+ results.duplicateTest = duplicates.length === 0;
78
+ console.log(` Duplicates found: ${duplicates.length}`);
79
+ console.log(` Result: ${results.duplicateTest ? 'โœ…' : 'โŒ'}\n`);
80
+
81
+ // Test 3: ID format validation
82
+ console.log('๐Ÿ“ Format Validation:');
83
+ const invalidFormats = safeguardIds.filter(id => !/^\d+\.\d+$/.test(id));
84
+ results.formatTest = invalidFormats.length === 0;
85
+ console.log(` Invalid formats: ${invalidFormats.length}`);
86
+ console.log(` Result: ${results.formatTest ? 'โœ…' : 'โŒ'}\n`);
87
+
88
+ // Test 4: Syntax validation (already done by eval above)
89
+ console.log('โš™๏ธ Syntax Validation:');
90
+ results.syntaxTest = true; // If we got here, syntax is valid
91
+ console.log(` Result: โœ…\n`);
92
+
93
+ // Test 5: Required fields validation
94
+ console.log('๐Ÿ“‹ Fields Validation:');
95
+ let fieldsValid = true;
96
+ const sampleSafeguard = safeguards[safeguardIds[0]];
97
+ const missingFields = this.requiredFields.filter(field => !(field in sampleSafeguard));
98
+
99
+ if (missingFields.length > 0) {
100
+ console.log(` Missing fields in sample: ${missingFields.join(', ')}`);
101
+ fieldsValid = false;
102
+ }
103
+
104
+ // Check a few random safeguards for field completeness
105
+ const testSafeguards = [safeguardIds[0], safeguardIds[Math.floor(safeguardIds.length / 2)], safeguardIds[safeguardIds.length - 1]];
106
+ for (const id of testSafeguards) {
107
+ const missing = this.requiredFields.filter(field => !(field in safeguards[id]));
108
+ if (missing.length > 0) {
109
+ console.log(` Missing fields in ${id}: ${missing.join(', ')}`);
110
+ fieldsValid = false;
111
+ }
112
+ }
113
+
114
+ results.fieldsTest = fieldsValid;
115
+ console.log(` Result: ${fieldsValid ? 'โœ…' : 'โŒ'}\n`);
116
+
117
+ // Test 6: Control coverage
118
+ console.log('๐ŸŽฏ Control Coverage:');
119
+ const controlCounts = {};
120
+ safeguardIds.forEach(id => {
121
+ const control = parseInt(id.split('.')[0]);
122
+ controlCounts[control] = (controlCounts[control] || 0) + 1;
123
+ });
124
+
125
+ let allControlsPresent = true;
126
+ for (let i = 1; i <= this.expectedControls; i++) {
127
+ const count = controlCounts[i] || 0;
128
+ if (count === 0) {
129
+ console.log(` โŒ Control ${i}: Missing`);
130
+ allControlsPresent = false;
131
+ } else {
132
+ console.log(` โœ… Control ${i}: ${count} safeguards`);
133
+ }
134
+ }
135
+
136
+ results.controlsTest = allControlsPresent;
137
+ console.log(` Result: ${allControlsPresent ? 'โœ…' : 'โŒ'}\n`);
138
+
139
+ } catch (error) {
140
+ console.log('โŒ Validation error:', error.message);
141
+ return false;
142
+ }
143
+
144
+ // Overall result
145
+ const allTestsPassed = Object.values(results).every(test => test);
146
+ console.log('๐ŸŽฏ Overall Validation Result:');
147
+ console.log(` Status: ${allTestsPassed ? 'โœ… PASSED' : 'โŒ FAILED'}`);
148
+ console.log(` Details:`, results);
149
+
150
+ return allTestsPassed;
151
+ }
152
+ }
153
+
154
+ // Main execution
155
+ if (require.main === module) {
156
+ const validator = new SafeguardsValidator();
157
+
158
+ console.log('๐Ÿ” CIS Safeguards Comprehensive Validation\n');
159
+ console.log('=' .repeat(50) + '\n');
160
+
161
+ // Test the formatted data ready for integration
162
+ const testFile = '/tmp/formatted_safeguards_ready.ts';
163
+ const isValid = validator.validateFile(testFile);
164
+
165
+ console.log('\n' + '='.repeat(50));
166
+ console.log(`Final Result: ${isValid ? 'โœ… READY FOR INTEGRATION' : 'โŒ NOT READY'}`);
167
+
168
+ if (!isValid) {
169
+ console.log('\nโŒ Issues found - please fix before proceeding with integration');
170
+ process.exit(1);
171
+ } else {
172
+ console.log('\n๐ŸŽ‰ All validations passed - data is ready for SafeguardManager integration!');
173
+ }
174
+ }
175
+
176
+ module.exports = SafeguardsValidator;
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Safeguard Count and Validation Script
5
+ */
6
+
7
+ const fs = require('fs');
8
+
9
+ console.log('๐Ÿ”ข CIS Safeguards Count and Validation\n');
10
+
11
+ const originalData = fs.readFileSync('/tmp/complete_cis_safeguards.ts', 'utf8');
12
+
13
+ // Extract all safeguard IDs using regex
14
+ const safeguardPattern = /"(\d+\.\d+)":\s*{/g;
15
+ const safeguardIds = [];
16
+ let match;
17
+
18
+ while ((match = safeguardPattern.exec(originalData)) !== null) {
19
+ safeguardIds.push(match[1]);
20
+ }
21
+
22
+ console.log('๐Ÿ“Š Safeguard Count Analysis:');
23
+ console.log(` Total safeguards found: ${safeguardIds.length}`);
24
+
25
+ // Sort safeguards numerically
26
+ const sortedIds = safeguardIds.sort((a, b) => {
27
+ const [aMajor, aMinor] = a.split('.').map(Number);
28
+ const [bMajor, bMinor] = b.split('.').map(Number);
29
+ return aMajor - bMajor || aMinor - bMinor;
30
+ });
31
+
32
+ console.log(` First safeguard: ${sortedIds[0]}`);
33
+ console.log(` Last safeguard: ${sortedIds[sortedIds.length - 1]}`);
34
+
35
+ // Check for duplicates
36
+ const duplicates = safeguardIds.filter((id, index) => safeguardIds.indexOf(id) !== index);
37
+ if (duplicates.length > 0) {
38
+ console.log('โŒ Duplicate safeguards found:', duplicates);
39
+ } else {
40
+ console.log('โœ… No duplicate safeguards');
41
+ }
42
+
43
+ // Group by control
44
+ const byControl = {};
45
+ sortedIds.forEach(id => {
46
+ const control = id.split('.')[0];
47
+ if (!byControl[control]) byControl[control] = [];
48
+ byControl[control].push(id);
49
+ });
50
+
51
+ console.log('\n๐Ÿ“‹ Safeguards by Control:');
52
+ for (let i = 1; i <= 18; i++) {
53
+ const controlSafeguards = byControl[i.toString()] || [];
54
+ console.log(` Control ${i}: ${controlSafeguards.length} safeguards`);
55
+ if (controlSafeguards.length > 0) {
56
+ console.log(` Range: ${controlSafeguards[0]} - ${controlSafeguards[controlSafeguards.length - 1]}`);
57
+ }
58
+ }
59
+
60
+ // Validate expected total
61
+ const expectedTotal = 153;
62
+ console.log('\n๐ŸŽฏ Validation Results:');
63
+ console.log(` Expected: ${expectedTotal} safeguards`);
64
+ console.log(` Found: ${safeguardIds.length} safeguards`);
65
+
66
+ if (safeguardIds.length === expectedTotal) {
67
+ console.log('โœ… Perfect count match!');
68
+ } else {
69
+ console.log(`โŒ Count mismatch: ${safeguardIds.length - expectedTotal} difference`);
70
+ }
71
+
72
+ // Check for missing controls
73
+ const missingControls = [];
74
+ for (let i = 1; i <= 18; i++) {
75
+ if (!byControl[i.toString()] || byControl[i.toString()].length === 0) {
76
+ missingControls.push(i);
77
+ }
78
+ }
79
+
80
+ if (missingControls.length === 0) {
81
+ console.log('โœ… All 18 CIS Controls represented');
82
+ } else {
83
+ console.log('โŒ Missing controls:', missingControls);
84
+ }
85
+
86
+ console.log('\n๐Ÿ“„ Sample safeguards:');
87
+ sortedIds.slice(0, 5).forEach(id => console.log(` - ${id}`));
88
+ console.log(' ...');
89
+ sortedIds.slice(-5).forEach(id => console.log(` - ${id}`));
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Properly format CIS Safeguards data with readable indentation
5
+ */
6
+
7
+ const fs = require('fs');
8
+
9
+ console.log('โœจ Properly Formatting CIS Safeguards Data\n');
10
+
11
+ // Read original data
12
+ const originalData = fs.readFileSync('/tmp/complete_cis_safeguards.ts', 'utf8');
13
+
14
+ // Extract just the safeguards object content (between the braces)
15
+ const match = originalData.match(/const CIS_SAFEGUARDS[^=]*=\s*({[\s\S]*});/);
16
+ if (!match) {
17
+ console.log('โŒ Failed to extract safeguards object');
18
+ process.exit(1);
19
+ }
20
+
21
+ const safeguardsObject = match[1];
22
+
23
+ console.log('โœ… Extracted safeguards object');
24
+
25
+ // Create properly formatted assignment for SafeguardManager
26
+ const formattedContent = ` // Complete CIS Controls v8.1 Framework - 153 safeguards across 18 controls
27
+ // Migrated from original implementation on ${new Date().toISOString().split('T')[0]}
28
+ this.safeguards = ${safeguardsObject};`;
29
+
30
+ // Write formatted data
31
+ fs.writeFileSync('/tmp/formatted_safeguards_ready.ts', formattedContent);
32
+
33
+ console.log('โœ… Properly formatted data saved to /tmp/formatted_safeguards_ready.ts');
34
+
35
+ // Show preview of properly formatted data
36
+ const lines = formattedContent.split('\n');
37
+ console.log('\n๐Ÿ“„ Preview (first 20 lines):');
38
+ lines.slice(0, 20).forEach((line, i) => console.log(`${i + 1}: ${line}`));
39
+ console.log(' ...');
40
+
41
+ console.log('\n๐Ÿ“Š Final Statistics:');
42
+ console.log(' Lines:', lines.length);
43
+ console.log(' Size:', formattedContent.length, 'characters');
44
+ console.log(' Ready for direct integration into SafeguardManager โœ…');
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Validate formatted safeguards data for integration readiness
5
+ */
6
+
7
+ const fs = require('fs');
8
+
9
+ console.log('๐Ÿ” Validating Formatted Safeguards Data\n');
10
+
11
+ // Read formatted data
12
+ const formattedData = fs.readFileSync('/tmp/formatted_safeguards_ready.ts', 'utf8');
13
+
14
+ // Extract safeguard IDs from formatted data
15
+ const idPattern = /"(\d+\.\d+)":\s*{/g;
16
+ const foundIds = [];
17
+ let match;
18
+
19
+ while ((match = idPattern.exec(formattedData)) !== null) {
20
+ foundIds.push(match[1]);
21
+ }
22
+
23
+ console.log('๐Ÿ“Š Validation Results:');
24
+ console.log(` Safeguards found: ${foundIds.length}`);
25
+
26
+ // Check for duplicates
27
+ const duplicates = foundIds.filter((id, index) => foundIds.indexOf(id) !== index);
28
+ if (duplicates.length > 0) {
29
+ console.log('โŒ Duplicates found:', duplicates);
30
+ } else {
31
+ console.log('โœ… No duplicates');
32
+ }
33
+
34
+ // Validate ID format
35
+ const invalidIds = foundIds.filter(id => !/^\d+\.\d+$/.test(id));
36
+ if (invalidIds.length > 0) {
37
+ console.log('โŒ Invalid ID formats:', invalidIds);
38
+ } else {
39
+ console.log('โœ… All IDs follow X.Y format');
40
+ }
41
+
42
+ // Sort and check sequence
43
+ const sortedIds = foundIds.sort((a, b) => {
44
+ const [aMajor, aMinor] = a.split('.').map(Number);
45
+ const [bMajor, bMinor] = b.split('.').map(Number);
46
+ return aMajor - bMajor || aMinor - bMinor;
47
+ });
48
+
49
+ console.log(` ID range: ${sortedIds[0]} to ${sortedIds[sortedIds.length - 1]}`);
50
+
51
+ // Check control coverage
52
+ const controlCounts = {};
53
+ sortedIds.forEach(id => {
54
+ const control = id.split('.')[0];
55
+ controlCounts[control] = (controlCounts[control] || 0) + 1;
56
+ });
57
+
58
+ console.log('\n๐Ÿ“‹ Control Coverage:');
59
+ for (let i = 1; i <= 18; i++) {
60
+ const count = controlCounts[i.toString()] || 0;
61
+ console.log(` Control ${i}: ${count} safeguards ${count === 0 ? 'โŒ' : 'โœ…'}`);
62
+ }
63
+
64
+ // Syntax validation - try to evaluate as JavaScript object
65
+ console.log('\n๐Ÿ” Syntax Validation:');
66
+ try {
67
+ // Extract just the object part for validation
68
+ const objectMatch = formattedData.match(/this\.safeguards = ({[\s\S]*});/);
69
+ if (objectMatch) {
70
+ // Basic syntax check by attempting to parse
71
+ eval(`const testObj = ${objectMatch[1]}`);
72
+ console.log('โœ… Valid JavaScript object syntax');
73
+
74
+ // Check if object has expected safeguard count
75
+ eval(`const safeguardsCount = Object.keys(${objectMatch[1]}).length`);
76
+ console.log(`โœ… Object contains ${eval(`Object.keys(${objectMatch[1]}).length`)} properties`);
77
+ } else {
78
+ console.log('โŒ Could not extract object for validation');
79
+ }
80
+ } catch (error) {
81
+ console.log('โŒ Syntax validation failed:', error.message);
82
+ }
83
+
84
+ console.log('\n๐ŸŽฏ Final Validation Summary:');
85
+ console.log(` Expected: 153 safeguards`);
86
+ console.log(` Found: ${foundIds.length} safeguards`);
87
+ console.log(` Match: ${foundIds.length === 153 ? 'โœ…' : 'โŒ'}`);
88
+ console.log(` Ready for integration: ${foundIds.length === 153 && duplicates.length === 0 && invalidIds.length === 0 ? 'โœ…' : 'โŒ'}`);