T09 · Insecure Skill Coding Practices
- Location
scripts/omnifocus.py:968- Finding
Write authorization can be persistently disabled through an unprotected preferences command
- Content
View full analysis
None: sub = args[0] if args else "show" if sub == "show": _out(_load_prefs()) elif sub == "set": if len(args) < 2: _err("Usage: prefs set ") mode = args[1] if mode not in ("yolo", "once", "every"): _err(f"Invalid mode: {mode}. Use: yolo, once, every") prefs = _load_prefs() prefs["mode"] = mode _save_prefs(prefs) _ok(mode=mode) ``` The authorization guard is applied only to commands contained in `WRITE_COMMANDS`: ```python cmd = argv[0] args = argv[1:] # Auth guard — outside try/except so exit(2) is never swallowed as an error. if cmd in WRITE_COMMANDS: _require_auth(cmd, authorized) try: if cmd == "inbox": cmd_inbox() ``` The `prefs` command is not included in `WRITE_COMMANDS`: ```python WRITE_COMMANDS = frozenset({ "add", "newproject", "newfolder", "newtag", "complete", "uncomplete", "delete", "rename", "note", "setnote", "defer", "due", "flag", "tag", "untag", "move", "repeat", "unrepeat", }) ``` ### Technical Analysis The application implements three authorization modes: - `once`: write commands must be approved by command name. - `every`: each write invocation must include `--authorized`. - `yolo`: all write operations are allowed without additional authorization. However, changing the authorization mode is itself not treated as a protected operation. Any caller capable of invoking the CLI can run `prefs set yolo` without satisfying the existing authorization policy. The resulting preference is persisted to `~/.omnifocus4/prefs.json`, after which `_require_auth()` immediately permits every write comman ...[truncated 1958 chars]- Remediation
View remediation
