@massa-ai/mcp-client 1.18.0 → 1.19.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/index.js +90 -8
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -136508,6 +136508,72 @@ var init_attribution_resolver = __esm(() => {
|
|
|
136508
136508
|
init_session_pin_store();
|
|
136509
136509
|
});
|
|
136510
136510
|
|
|
136511
|
+
// ../../packages/core/dist/kernel/sanitize/credential-scrub.js
|
|
136512
|
+
function markerFor(id) {
|
|
136513
|
+
return `[REDACTED:${id}]`;
|
|
136514
|
+
}
|
|
136515
|
+
function fullMatchRule(id, pattern) {
|
|
136516
|
+
const marker26 = markerFor(id);
|
|
136517
|
+
return {
|
|
136518
|
+
id,
|
|
136519
|
+
replace(text3) {
|
|
136520
|
+
let count = 0;
|
|
136521
|
+
const replaced = text3.replace(pattern, () => {
|
|
136522
|
+
count++;
|
|
136523
|
+
return marker26;
|
|
136524
|
+
});
|
|
136525
|
+
return { text: replaced, count };
|
|
136526
|
+
}
|
|
136527
|
+
};
|
|
136528
|
+
}
|
|
136529
|
+
function scrubCredentials(payloadJson) {
|
|
136530
|
+
const redactions = {};
|
|
136531
|
+
for (const id of RULE_IDS)
|
|
136532
|
+
redactions[id] = 0;
|
|
136533
|
+
let text3 = payloadJson;
|
|
136534
|
+
for (const rule of RULES) {
|
|
136535
|
+
const { text: next, count } = rule.replace(text3);
|
|
136536
|
+
text3 = next;
|
|
136537
|
+
redactions[rule.id] += count;
|
|
136538
|
+
}
|
|
136539
|
+
const total = Object.values(redactions).reduce((sum, n) => sum + n, 0);
|
|
136540
|
+
return {
|
|
136541
|
+
sanitized: text3,
|
|
136542
|
+
redactions,
|
|
136543
|
+
total
|
|
136544
|
+
};
|
|
136545
|
+
}
|
|
136546
|
+
var PEM_PATTERN, JWT_PATTERN, AWS_KEY_PATTERN, SK_KEY_PATTERN, GITHUB_TOKEN_PATTERN, SLACK_TOKEN_PATTERN, BEARER_PATTERN, RULES, RULE_IDS;
|
|
136547
|
+
var init_credential_scrub = __esm(() => {
|
|
136548
|
+
PEM_PATTERN = /-----BEGIN [A-Z ]{0,32}PRIVATE KEY-----[\s\S]{0,8192}?-----END [A-Z ]{0,32}PRIVATE KEY-----/g;
|
|
136549
|
+
JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
136550
|
+
AWS_KEY_PATTERN = /\b(?:AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}\b/g;
|
|
136551
|
+
SK_KEY_PATTERN = /\bsk-[A-Za-z0-9_-]{20,}\b/g;
|
|
136552
|
+
GITHUB_TOKEN_PATTERN = /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}\b/g;
|
|
136553
|
+
SLACK_TOKEN_PATTERN = /\bxox[baprs]-[A-Za-z0-9-]{18,}\b/g;
|
|
136554
|
+
BEARER_PATTERN = /(Bearer\s+)([A-Za-z0-9._~+/=-]{20,})/g;
|
|
136555
|
+
RULES = [
|
|
136556
|
+
fullMatchRule("pem", PEM_PATTERN),
|
|
136557
|
+
fullMatchRule("jwt", JWT_PATTERN),
|
|
136558
|
+
fullMatchRule("aws-key", AWS_KEY_PATTERN),
|
|
136559
|
+
fullMatchRule("sk-key", SK_KEY_PATTERN),
|
|
136560
|
+
fullMatchRule("github-token", GITHUB_TOKEN_PATTERN),
|
|
136561
|
+
fullMatchRule("slack-token", SLACK_TOKEN_PATTERN),
|
|
136562
|
+
{
|
|
136563
|
+
id: "bearer",
|
|
136564
|
+
replace(text3) {
|
|
136565
|
+
let count = 0;
|
|
136566
|
+
const replaced = text3.replace(BEARER_PATTERN, (_m, prefix) => {
|
|
136567
|
+
count++;
|
|
136568
|
+
return `${prefix}${markerFor("bearer")}`;
|
|
136569
|
+
});
|
|
136570
|
+
return { text: replaced, count };
|
|
136571
|
+
}
|
|
136572
|
+
}
|
|
136573
|
+
];
|
|
136574
|
+
RULE_IDS = RULES.map((r) => r.id);
|
|
136575
|
+
});
|
|
136576
|
+
|
|
136511
136577
|
// ../../packages/core/dist/tools/compact_snapshot.js
|
|
136512
136578
|
class CompactSnapshotTool {
|
|
136513
136579
|
name = "compact_snapshot";
|
|
@@ -136559,19 +136625,26 @@ class CompactSnapshotTool {
|
|
|
136559
136625
|
persistedId = newObservationId();
|
|
136560
136626
|
try {
|
|
136561
136627
|
const attribution = await (this.resolverOverride ?? getAttributionResolver()).resolve({ callerProjectId: projectId, sessionId, cwd });
|
|
136628
|
+
const scrub = scrubCredentials(JSON.stringify({
|
|
136629
|
+
snapshot: snapshot.xml,
|
|
136630
|
+
eventCount: snapshot.eventCount,
|
|
136631
|
+
compactCount: snapshot.compactCount,
|
|
136632
|
+
generatedAt: snapshot.generatedAt,
|
|
136633
|
+
sectionCount: snapshot.sections.length
|
|
136634
|
+
}));
|
|
136635
|
+
if (scrub.total > 0) {
|
|
136636
|
+
logger.debug("compact_snapshot payload redacted before persist", {
|
|
136637
|
+
redactions: scrub.redactions,
|
|
136638
|
+
total: scrub.total
|
|
136639
|
+
});
|
|
136640
|
+
}
|
|
136562
136641
|
store4.insert({
|
|
136563
136642
|
id: persistedId,
|
|
136564
136643
|
projectId: attribution.projectId,
|
|
136565
136644
|
sessionId,
|
|
136566
136645
|
source: "pre-compact",
|
|
136567
136646
|
category: "compaction-snapshots",
|
|
136568
|
-
payloadJson:
|
|
136569
|
-
snapshot: snapshot.xml,
|
|
136570
|
-
eventCount: snapshot.eventCount,
|
|
136571
|
-
compactCount: snapshot.compactCount,
|
|
136572
|
-
generatedAt: snapshot.generatedAt,
|
|
136573
|
-
sectionCount: snapshot.sections.length
|
|
136574
|
-
}),
|
|
136647
|
+
payloadJson: scrub.sanitized,
|
|
136575
136648
|
importance: 0.8,
|
|
136576
136649
|
createdAt: Date.now(),
|
|
136577
136650
|
attributionSource: attribution.source
|
|
@@ -136623,6 +136696,7 @@ var init_compact_snapshot = __esm(() => {
|
|
|
136623
136696
|
init_observation_repository();
|
|
136624
136697
|
init_compaction_snapshot_service();
|
|
136625
136698
|
init_attribution_resolver();
|
|
136699
|
+
init_credential_scrub();
|
|
136626
136700
|
});
|
|
136627
136701
|
|
|
136628
136702
|
// ../../packages/core/dist/tools/list_projects.js
|
|
@@ -162259,13 +162333,20 @@ class HookService {
|
|
|
162259
162333
|
});
|
|
162260
162334
|
const id = this.idFactory();
|
|
162261
162335
|
this.queue.enqueue(async () => {
|
|
162336
|
+
const scrub = scrubCredentials(JSON.stringify(ev.payload));
|
|
162337
|
+
if (scrub.total > 0) {
|
|
162338
|
+
logger.debug("hook payload redacted before persist", {
|
|
162339
|
+
redactions: scrub.redactions,
|
|
162340
|
+
total: scrub.total
|
|
162341
|
+
});
|
|
162342
|
+
}
|
|
162262
162343
|
const obs = {
|
|
162263
162344
|
id,
|
|
162264
162345
|
projectId: attribution.projectId,
|
|
162265
162346
|
sessionId: ev.sessionId,
|
|
162266
162347
|
source: ev.event,
|
|
162267
162348
|
category: extractCategory(ev.event, ev.payload),
|
|
162268
|
-
payloadJson:
|
|
162349
|
+
payloadJson: scrub.sanitized,
|
|
162269
162350
|
importance: ev.importance,
|
|
162270
162351
|
createdAt: ev.ts,
|
|
162271
162352
|
agentId: ev.agentId,
|
|
@@ -162326,6 +162407,7 @@ var init_hook_service = __esm(() => {
|
|
|
162326
162407
|
init_observation_extractor();
|
|
162327
162408
|
init_observation_consolidation_job();
|
|
162328
162409
|
init_attribution_resolver();
|
|
162410
|
+
init_credential_scrub();
|
|
162329
162411
|
ValidationError = class ValidationError extends Error {
|
|
162330
162412
|
code;
|
|
162331
162413
|
constructor(code, message) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massa-ai/mcp-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "massa-ai MCP server - Semantic code search, memory, and context compression via Model Context Protocol",
|
|
5
5
|
"author": "luizgmassa",
|
|
6
6
|
"type": "module",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"type-check": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@massa-ai/core": "^1.
|
|
24
|
-
"@massa-ai/shared": "^1.
|
|
23
|
+
"@massa-ai/core": "^1.19.0",
|
|
24
|
+
"@massa-ai/shared": "^1.19.0",
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|