fix(codex/synthesize/verify): neutralize prompt injection + harden error/edge paths
CRITICAL: untrusted extracted text fenced (inert-data delimiter + sentinel neutralize) before codex calls that run with headless bypass. HIGH: codexJson + listRecords JSON.parse guarded; fingerprint/atomFingerprint scoped by cluster id (no silent skip on shared/empty source refs); headOk uses a fresh timeout per request; synthesize reports degraded when --deep falls back. Codex scratch in one private 0700 mkdtemp. verifyDeep now covered by a stub-codex selftest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
45c03a499a
commit
6714bec65a
@@ -2,7 +2,7 @@
|
||||
import { promises as fs } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import crypto from 'node:crypto'
|
||||
import { codexAvailable, codexJson } from './mnemazine-codex.mjs'
|
||||
import { codexAvailable, codexJson, fenceUntrusted } from './mnemazine-codex.mjs'
|
||||
import { verifyLocal, verifyDeep } from './mnemazine-verify.mjs'
|
||||
|
||||
const ROOT = process.env.MNEMAZINE_ROOT || path.resolve(process.cwd())
|
||||
@@ -134,8 +134,9 @@ function uniq(values) {
|
||||
// ponytail: exact-dup only via source-ref hash; near-duplicate (paraphrase)
|
||||
// dedup needs embeddings — wire fastembed/Ollama here if dup clusters appear.
|
||||
function fingerprint(cluster) {
|
||||
const refs = cluster.records.map(record => String(record.source_ref || '')).sort()
|
||||
return crypto.createHash('sha1').update(refs.join(' | ||||