prism-mcp-server 18.0.1 → 18.0.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/README.md CHANGED
@@ -64,7 +64,7 @@ Free tier runs entirely on your machine — SQLite, local embedding model, no AP
64
64
  |--|---|---|
65
65
  | Tool-call latency | 200ms–3s | **~1.6s (1.7B) / ~1.1s (14B)** |
66
66
  | API key required | Yes | **No** |
67
- | Data sent externally | Every prompt | **Nothing** |
67
+ | Data sent externally | Every prompt | **Nothing (free tier)** |
68
68
  | Works offline | ❌ | ✅ |
69
69
  | Cost at scale | $0.002–0.06/call | **$0** |
70
70
  | HIPAA | Requires BAA | **On-prem = no BAA** |
@@ -84,20 +84,23 @@ export async function isAuthenticated(req, config) {
84
84
  try {
85
85
  const token = authHeader.slice(7);
86
86
  const verifyOpts = {
87
- clockTolerance: 30, // 30s clock skew tolerance
87
+ clockTolerance: 30,
88
+ // audience + issuer are REQUIRED when JWKS is configured — prevents
89
+ // cross-service token confusion (adversarial review H1, 2026-06-12).
90
+ audience: config.jwtAudience || "prism-mcp",
91
+ issuer: config.jwtIssuer || "https://synalux.ai",
88
92
  };
89
- if (config.jwtAudience)
90
- verifyOpts.audience = config.jwtAudience;
91
- if (config.jwtIssuer)
92
- verifyOpts.issuer = config.jwtIssuer;
93
93
  const { payload } = await jwtVerify(token, jwksCache, verifyOpts);
94
94
  const payloadDict = payload;
95
- // Attach agent_id and AgentLair audit metadata to the request for downstream traceability
96
95
  const authReq = req;
97
96
  authReq.agent_id =
98
97
  payloadDict.agent_id || payload.sub;
99
98
  authReq.al_name = payloadDict.al_name;
100
- authReq.al_audit_url = payloadDict.al_audit_url;
99
+ // al_audit_url is untrusted (attacker-influenceable via token) — do not
100
+ // act on it or call it. Stored for logging only, never fetched.
101
+ authReq.al_audit_url = typeof payloadDict.al_audit_url === "string"
102
+ ? payloadDict.al_audit_url.slice(0, 256)
103
+ : undefined;
101
104
  return true;
102
105
  }
103
106
  catch (err) {
@@ -63,6 +63,10 @@ async function generateQAPairs(chunk, source) {
63
63
  debugLog("[ingest] No ANTHROPIC_API_KEY — skipping Q&A generation, storing raw chunks");
64
64
  return [{ prompt: `What does this ${source} code do?`, response: chunk.slice(0, 500) }];
65
65
  }
66
+ // PHI redaction BEFORE sending to cloud LLM — the chunk may contain
67
+ // client names in file paths, inline identifiers, or clinical notes.
68
+ const { scanAndRedactPHI } = await import("../utils/phiGuard.js");
69
+ const redactedChunk = scanAndRedactPHI(chunk).redacted;
66
70
  try {
67
71
  const res = await fetch("https://api.anthropic.com/v1/messages", {
68
72
  method: "POST",
@@ -75,7 +79,7 @@ async function generateQAPairs(chunk, source) {
75
79
  model: "claude-haiku-4-5-20251001",
76
80
  max_tokens: 2048,
77
81
  system: 'Generate 3 Q&A training pairs as JSON array: [{"prompt":"...","response":"..."}]. Focus on what the code does, how it works, and key patterns.',
78
- messages: [{ role: "user", content: `Source: ${source}\n\`\`\`\n${chunk.slice(0, 5000)}\n\`\`\`` }],
82
+ messages: [{ role: "user", content: `Source: ${source}\n\`\`\`\n${redactedChunk.slice(0, 5000)}\n\`\`\`` }],
79
83
  }),
80
84
  });
81
85
  if (!res.ok) {
@@ -98,7 +98,7 @@ export async function sessionSaveLedgerHandler(args) {
98
98
  const conversation_id = args.conversation_id;
99
99
  const summary = sanitizeMemoryInput(args.summary);
100
100
  const todos = args.todos ? sanitizeArray(args.todos) : undefined;
101
- const files_changed = args.files_changed;
101
+ const files_changed = args.files_changed ? sanitizeArray(args.files_changed) : undefined;
102
102
  const decisions = args.decisions ? sanitizeArray(args.decisions) : undefined;
103
103
  const role = args.role;
104
104
  const storage = await getStorage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "18.0.1",
3
+ "version": "18.0.2",
4
4
  "mcpName": "io.github.dcostenco/prism-coder",
5
5
  "description": "Prism Coder — Cognitive memory + tool-calling intelligence for AI agents. Mind Palace persistent memory (BFCL Gold Certified, 100% Tool-Call Accuracy, 114 Agent Skills, PHI Guard, Tier Enforcement, Prompt-Based Skill Routing, Zero-Search HDC/HRR retrieval, HRR Semantic Drift Detection across BCBA/Coding/AAC domains, HIPAA-hardened local-first storage, SLERP-optimized GRPO alignment) plus the prism-coder 1.7B–32B open-weights LLM fleet.",
6
6
  "module": "index.ts",