# Security notes ## What the binary reads * the system clock (`time()`), for "now" - overridable with `SX_TIME_NOW` for deterministic tests; * `$TZ`, `/etc/localtime` (readlink) and `/etc/timezone` on POSIX, and the platform timezone information on Windows, to name the node's own zone. That is the whole list. Everything else - every offset, abbreviation and DST rule - comes from the table compiled into the binary. ## What it does not do `tests/run.sh` asserts the connector sources contain none of: `popen`, `system`, `socket`, `connect`, `fork`, `execv`, `fopen` for write or append, `remove`, `unlink`, `rmdir`, `mkdir`, `rename`, `chmod`, `curl`, `wget`. So there is no file written, no directory created, no program run and no outbound request. The plugin is a pure function of (instant, zone name). ## Authentication The page and the JSON API sit behind `require_node_auth()`, which accepts `X-Bot-Password`, `Authorization: Bearer ` or `?pwd=` and 401s when `BOT_PASSWORD` is set and none match. `--meta` and `--mcp` stay open: the node spawns the stdio server itself, and `/plugins` must be able to discover the connector. A bare `curl http://:8150/plugin_time` on a node with `BOT_PASSWORD` set answers **401**, which is the first check to run after installing anything. ## Input handling * A timezone argument is validated against the embedded key list - exact, case-sensitive - after a cheap rejection of `..`, `/`, `\`, `%`, control characters and anything over 96 bytes. An unknown key is an error naming it; it is never treated as a path. * A JSON string whose declared length differs from its C string length (an embedded NUL) is refused rather than silently truncated to its prefix. * `time` must be exactly five characters of `HH:MM` with a real hour and minute. * Every `yyjson` value is emitted with the *copying* constructor. The non-copying one stores the caller's pointer, and every description and zone name in this code lives in a stack buffer that is reused - which produces valid-looking JSON with the wrong text. ## Build hardening `make asan` builds with `-fsanitize=address,undefined -D_FORTIFY_SOURCE=2`, and the suite drives the whole tool set, the repeated-hour path (the allocation-heavy one) and the page through it, asserting no sanitizer output.