Security

Security architecture

Implementation snapshot of the XOBIT security model: trust boundaries, stored secrets, transport rules, and operator settings.

This is not a third-party audit or security certification.

System Layers

LayerMechanismSecurity Rule
Browser workspaceStatic browser app plus local storageThe browser profile is trusted. Projects, revisions, chat history, specifications, API keys, connection history, MQTT settings, and online sign-in keys can be stored locally. Anyone with access to the same browser profile may be able to inspect or remove them.
USB transportWeb Serial and esptool-jsUSB access requires the browser permission picker. Once granted, the browser can install firmware, configure the board, upload scripts, and read logs. USB is the recovery and first-install authority.
Board storageLittleFS /config.json, script files, and NVS stateThe ESP32 stores WiFi credentials, MQTT settings, online auth keys, guest flags, guest key, device identity, and scripts locally. This storage is not presented as encrypted-at-rest.
MQTT brokerMQTT.js in the browser, Arduino MQTT on firmwareBroker username/password only controls broker access. XOBIT protocol authorization is separate and happens inside the MQTT payload layer.
XOBIT online protocolMessagePack frames, challenge auth, AES-CTR, and HMAC-SHA256Full MQTT control requires a named online user by default. Full unauthenticated online control is only available when its dedicated setting is deliberately enabled. Guest UI and guest script access are separate limited permissions. After sign-in, MQTT command/response payloads are encrypted and authenticated by the XOBIT session layer.
AI serviceOpenAI API over browser HTTPS requestsThe OpenAI API key is stored in the browser and sent to OpenAI when AI features are used. XOBIT does not proxy the key through its own server.
Firmware updateUSB install and optional SafeBoot OTA pathUSB remains the recovery path. OTA is configuration-dependent and validates requested source/target update metadata; it should not be treated as the only recovery mechanism.

Browser Storage

Board Storage

USB Layer

USB is intentionally powerful. The model assumes that a user who selects the ESP32 in the Web Serial picker intends to administer the board.

OperationRule
Firmware installUses Web Serial plus esptool-js. The browser can erase/install firmware according to the selected manifest and options.
Post-install setupAfter flashing, the browser can reconnect and apply initial device name, WiFi, MQTT, timezone, and access settings.
Direct developmentUSB can send commands, upload scripts, read status, and inspect logs without involving MQTT.
RecoveryUSB is the expected recovery route when online transport, OTA, WiFi, or script behavior fails.

MQTT Layer

MQTT has two distinct security levels: broker access and XOBIT protocol access. A broker password alone does not define who is allowed to control the board.

  1. Broker connection. The browser and board connect to the configured MQTT host and port using the configured broker username and password. The browser chooses wss:// when the page is served over HTTPS and ws:// otherwise.
  2. Topic root. The configured topic root is the complete XOBIT MQTT base prefix, for example xobit/my-board. Commands, responses, events, and hello messages live below that root.
  3. Device hello. The board publishes a hello message that states whether XOBIT auth is required, whether guest UI/script access is enabled, and whether a guest UI key exists.
  4. Default closed condition. On fresh firmware, allowUnauthenticatedAccess, mqttAllowAnonymousUi, and mqttAllowAnonymousScript are false. With no online users, the board does not start MQTT control even if WiFi and broker settings are present.
  5. Auth required condition. When one or more online users are configured and unauthenticated access is off, the board reports auth: "required" and requires XOBIT sign-in for normal MQTT control traffic.
  6. Full anonymous condition. If allowUnauthenticatedAccess is enabled, MQTT accepts normal command frames without online sign-in. Any MQTT client that can publish valid command frames to the board command topic through the broker namespace can control the board except for operations that still require USB or authenticated MQTT.
  7. Challenge response. The browser sends an auth-start frame with client id, username, and client nonce. The board replies with a server nonce. The browser proves the shared key with HMAC-SHA256 over a versioned auth string, ids, and both nonces.
  8. Secure session. After success, the board assigns a session id. Payloads are wrapped in secure MessagePack frames. The browser encrypts/decrypts with AES-CTR and signs/verifies with HMAC-SHA256. Counters reject replayed or stale frames.
Operational baseline

Configure at least one named online user for administrative MQTT control. Keep full unauthenticated online control off unless the object is intentionally public. Use guest UI or guest script only for deliberately limited public surfaces.

Guest Access

ModeAllowed SurfaceRule
Guest UIStatus light, system info, WiFi status, and script input command framesRequires Guest UI. Frames must include the generated guest key. This permission is independent of full unauthenticated online control.
Guest scriptMQTT script inbox text topicRequires Guest script. This permission is independent of full unauthenticated online control. Keep disabled unless the script treats incoming messages as untrusted public input.
Full online userNormal XOBIT command channelUse for administrative script upload, device configuration, and control workflows.

ChatGPT Key Handling

Firmware And Setup Rules

Setting or PathBehaviorTechnical Rule
WiFi settingsStored on the board and configured over USB or existing protocol connection.Use a network intended for experimental devices. Changing WiFi does not itself create online authorization.
MQTT enabledBoard connects online only when MQTT is enabled and at least one online path is configured: named online users, full unauthenticated control, Guest UI, or Guest script.Disable MQTT for USB-only projects.
Allow full unauthenticated online controlDefault off. When on, normal MQTT command frames can be accepted without online sign-in.Enable only for deliberate public or lab setups where any broker client in the namespace may be treated as allowed.
MQTT topic rootThe complete base topic prefix used by the board and browser.Use a unique project/device-specific root such as xobit/my-board. Treat predictable roots on public brokers as discoverable.
Online usersUsernames plus derived 32-byte keys are stored on the board.Add individual users; remove users that should no longer control the object.
Guest UIGenerates/stores a guest UI key if needed and enables the guest UI allowlist.Enable only for deliberately limited interfaces.
Guest scriptAccepts unauthenticated text on the script inbox topic.Default to off. Treat incoming messages as hostile input.
Home Assistant bridgeUses the compatibility layer without ESPHome Noise encryption.Treat as LAN-trusted until encrypted HA native API support is implemented.
HTTP from scriptsFirmware includes HTTP/TLS support, with defaults allowing insecure TLS behavior for script HTTP fetches.Do not treat script-level HTTP fetch as a high-assurance data channel without reviewing firmware build flags and endpoint validation.
OTASafeBoot OTA support is build/configuration dependent and USB remains recovery.OTA prepare, boot, and clear require USB or an authenticated MQTT secure session. Keep physical access during updates.

Deployment Position

Related Reference