{"record":{"id":"bada7d71c9cd9457","repo":"affaan-m/ECC","slug":"refusing-to-run-install-from-untrusted-repo-root","errorCode":null,"errorMessage":"Refusing to run install from untrusted repo root ${normalized}: package.json name '${pkgName}' is not an official ECC package.","messagePattern":"Refusing to run install from untrusted repo root (.+?): package\\.json name '(.+?)' is not an official ECC package\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/auto-update.js","lineNumber":150,"sourceCode":"  const packageJsonPath = path.join(normalized, 'package.json');\n  const installApplyPath = path.join(normalized, 'scripts', 'install-apply.js');\n\n  if (!fs.existsSync(packageJsonPath)) {\n    throw new Error(`Invalid ECC repo root: missing package.json at ${packageJsonPath}`);\n  }\n\n  if (!fs.existsSync(installApplyPath)) {\n    throw new Error(`Invalid ECC repo root: missing install script at ${installApplyPath}`);\n  }\n\n  let pkgName = null;\n  try {\n    pkgName = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name;\n  } catch {\n    throw new Error(`Invalid ECC repo root: unreadable package.json at ${packageJsonPath}`);\n  }\n  if (!ECC_PACKAGE_NAMES.has(pkgName)) {\n    throw new Error(`Refusing to run install from untrusted repo root ${normalized}: package.json name '${pkgName}' is not an official ECC package.`);\n  }\n\n  return normalized;\n}\n\nfunction runExternalCommand(command, args, options = {}) {\n  const result = spawnSync(command, args, {\n    cwd: options.cwd,\n    env: options.env || process.env,\n    encoding: 'utf8',\n    maxBuffer: 10 * 1024 * 1024\n  });\n\n  if (result.error) {\n    throw result.error;\n  }\n\n  if (typeof result.status === 'number' && result.status !== 0) {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/auto-update.js#L132-L168","documentation":"aura_verdict() is the only function in the AURA adapter that raises — and it raises ValueError solely for a malformed DID argument. The DID must be a non-empty string starting with the literal prefix 'did:'. This is treated as a caller bug, deliberately distinct from network/parse failures which return an `unknown` verdict instead of raising. All other errors (HTTP, DNS, malformed JSON, unexpected shape) are swallowed into a verdict.","triggerScenarios":"Calling aura_verdict('') (empty); aura_verdict(None); aura_verdict('z6Mk...') (raw multibase key with no did: method prefix); aura_verdict(123) (non-string).","commonSituations":"The DID variable was never populated from the request context; the wrong variable was passed (e.g. a raw key instead of a DID); a counterparty identifier field uses a different format than expected.","solutions":["Ensure the DID string starts with 'did:' — e.g. 'did:aura:z6Mk...' or 'did:key:z6Mk...'.","Validate the DID before calling: if not did or not str(did).startswith('did:'): handle gracefully.","Check that you are passing the counterparty DID from the correct field in your payload."],"exampleFix":"# before\nv = aura_verdid(raw_key)  # raw_key = 'z6Mk...' -> ValueError\n\n# after\ndid = f'did:key:{raw_key}' if not raw_key.startswith('did:') else raw_key\nv = aura_verdict(did)","handlingStrategy":"validation","validationCode":"# Validate the DID shape before calling aura_verdict.\ndef is_valid_did(did):\n    return isinstance(did, str) and did.startswith('did:') and len(did) > 4\n\nif not is_valid_did(counterparty_did):\n    raise ValueError(f'counterparty DID is malformed: {counterparty_did!r}')\nv = aura_verdict(counterparty_did)","typeGuard":"def is_valid_did(did) -> bool:\n    return isinstance(did, str) and did.startswith('did:') and len(did) > 4","tryCatchPattern":"try:\n    v = aura_verdict(did)\nexcept ValueError:\n    # This only fires for a malformed DID — a caller bug, not a network issue.\n    log.error('refusing to check trust: DID argument is malformed')\n    raise","preventionTips":["Treat a ValueError from aura_verdict as a caller bug — it never indicates a network problem.","Centralize DID formatting at the boundary where counterparty identifiers enter your system.","Remember network/parse failures return an `unknown` verdict and do NOT raise."],"tags":["validation","did","aura","input","trust"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}