Skip to content

v0.2.1: Security hardening, ZK Ristretto255, and resilience fixes#38

Merged
ApiliumDevTeam merged 15 commits intomainfrom
dev
Mar 14, 2026
Merged

v0.2.1: Security hardening, ZK Ristretto255, and resilience fixes#38
ApiliumDevTeam merged 15 commits intomainfrom
dev

Conversation

@ApiliumDevTeam
Copy link
Collaborator

Summary

  • ZK Proofs: Migrate from Ed25519 to Ristretto255 to match Cortex's curve25519-dalek format. Align Schnorr protocol with aingle_zk::verify_knowledge_proof. Add length-prefixed encoding to prevent concatenation collisions
  • Security: Double external content marker entropy (64 → 128 bits), replace Math.random() with CSPRNG for retry jitter, add timing side-channel mitigation in Schnorr proof generation
  • Dependencies: Update undici (7.22→7.24.2) and file-type (21.3.1→21.3.2) resolving 13 GitHub security advisories (WebSocket memory exhaustion, CRLF injection, HTTP smuggling, ZIP decompression bomb)
  • Resilience: Cap retry delay at 60s, move clearTimeout to finally block, add upper bounds to resilience config (300s/20 max), validate config with clampPositive()
  • Bash sandbox: Detect <(...) and >(...) process substitution outside quotes
  • DAG: Switch dagVerify from GET query string to POST body, extract fetchDag() helper to reduce duplication across 10 MCP tools
  • Memory health: Extract conflict detection and digest tools to dedicated module, scope conflict scanner to namespace for cross-namespace isolation
  • Error handling: Wrap engine.publish() and proofClient.requestZkProof() in try/catch to prevent MCP tool handler crashes when Cortex is unavailable
  • Docs: Update MCP tools table to 21 tools, add Gemini CLI and GitHub Copilot CLI roadmap
  • Cortex: Require AIngle Cortex >= 0.6.2

Test plan

  • 11,921 tests pass (npx vitest run)
  • ZK E2E: JS-generated Schnorr proof verified valid: true by live Cortex
  • Cortex health check passes on port 19090
  • MCP server connects via stdio (claude mcp list shows mayros: Connected)
  • WhatsApp channel connects and responds to inbound messages
  • No security advisories remaining on GitHub

Add mayros_memory_conflicts and mayros_memory_digest as MCP tools
and CLI commands for proactive memory maintenance. Conflicts tool
detects exact duplicates and graph-level contradictions. Digest tool
provides category distribution, recent entries, and DAG statistics.
Bump version to 0.2.1.
Prevent unbounded exponential backoff by capping retry delay at 60s.
Move clearTimeout to finally block so timers are always cleaned up
on network errors. Add clampPositive() to reject invalid resilience
config values (negative timeouts, zero circuit thresholds).
Increase marker ID from 8 to 16 random bytes (64 to 128 bits) to
reduce collision probability in adversarial content sanitization.
Detect <(...) and >(...) process substitution patterns outside quotes.
These can execute arbitrary commands and bypass blocklist checks,
so they now trigger the same subshell warning as $(...) and backticks.
Switch dagVerify from GET query string to POST body to match the
Cortex v0.6.1 API. Extract fetchDag() helper to reduce repetition
across 10 MCP DAG tools. Fix parseInt radix in dag prune CLI.
Move conflict detection and digest tools from memory-tools.ts to
memory-health-tools.ts for cleaner separation. Register in MCP
server alongside existing memory and DAG tools.
Increment counter before any await to prevent concurrent callers
from exceeding the assertion limit. Release the slot on failure
so it can be retried.
Switch from Ed25519 CompressedEdwardsY to Ristretto255
CompressedRistretto to match Cortex's curve25519-dalek format.
Align Schnorr protocol with aingle_zk::verify_knowledge_proof
(commitment=public key, challenge=H(R||P), response=k+cx).
Use length-prefixed encoding in secret derivation to prevent
concatenation collisions. Route membership proofs through
Knowledge type since Cortex Membership requires Merkle trees.
List all 21 MCP tools including DAG and memory health tools added
in v0.2.0-v0.2.1. Add coming-soon section for Gemini CLI and
GitHub Copilot CLI MCP integration.
Wrap engine.publish() and proofClient.requestZkProof() calls in
try/catch so Cortex connection failures return error messages
instead of crashing the MCP tool handler.
Cap resilience config values at sane maximums (300s for timeouts,
20 for counts) to prevent DoS via extreme config values. Scope
the memory conflict scanner to the tool's namespace to enforce
cross-namespace isolation.
Use crypto.getRandomValues() for retry jitter instead of predictable
Math.random(). Add dummy scalar computation with random inputs in
Schnorr proof generation to obscure timing of secret-dependent
BigInt operations.
undici 7.22.0 -> 7.24.2: fixes WebSocket memory exhaustion, CRLF
injection, HTTP smuggling, and 64-bit length overflow (6 CVEs).
file-type 21.3.1 -> 21.3.2: fixes ZIP decompression bomb DoS.
Prevents accidental commitment of sensitive files.
Enhances security by ensuring confidential data remains out of version control.
Bump minimum Cortex version for v0.2.1 compatibility
(dagVerify POST body, ZK Ristretto255 proofs).
@ApiliumDevTeam ApiliumDevTeam merged commit 79ea0ad into main Mar 14, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant