T09 · Insecure Skill Coding Practices
- Location
scripts/modules/customize.py:49- Finding
Unrestricted customization can disable encryption and rewrite the ledger as plaintext
- Content
View full analysis
None: parts = path.split(".") cur = d for p in parts[:-1]: nxt = cur.get(p) if not isinstance(nxt, dict): nxt = {} cur[p] = nxt cur = nxt cur[parts[-1]] = value ``` ```python for item in (args.set or []): if "=" not in item: raise ValueError(f"--set format must be DOTPATH=VALUE: {item}") path, _, raw = item.partition("=") changes["set"].append({ "path": path.strip(), "value": _parse_scalar(raw), }) ``` ```python new, _ = _apply_changes(contract, changes) changed = _diff(contract, new) contract_io.write_contract( data_dir, new, actor="configurator", confirm=True, ) ``` The contract writer selects encryption according to the new contract value: ```python encrypted = bool(contract.get("crypto", {}).get("enabled")) if encrypted: blob = crypto_io.seal_json(contract) with open(tmp, "wb") as f: f.write(blob) else: with open(tmp, "w", encoding="utf-8") as f: json.dump(contract, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The generic `--set` mechanism accepts an arbitrary dot path. It does not enforce an allowlist of documented customizable fields and does not reject security-sensitive fields such as `crypto.enabled`, `crypto.mode`, or `crypto.key_file`. The top-level schema guard only verifies that `crypto` is a recognized configuration field. Because customization writes as `actor="configurator"` with `confirm=True`, the generic guard does not prevent the change. Consequently, a command such as `--set crypto.enabled=false` can pass t ...[truncated 1766 chars]- Remediation
View remediation
