aiot-production-kit / grounded-tool-use-rbac
AI SAFETY · RBAC TOOL-USE & FAIL-SAFE

RBAC Tool-Use Validator & Hardware Fail-Safe Boundary Guard

Stops prompt-injection privilege escalation and blocks LLMs from overwriting industrial hardware cutoffs or mutating ERP production tables.

TL;DR ENGINEERING FACTS
  • Caller-Bound RBAC Whitelists: API gateway enforces role permissions independently of LLM prompts so viewers never invoke ERP or BMS advisories.
  • Strict Schema & Regex Sanitization: Rejects injection tokens (`; DROP TABLE`) and out-of-range bounds before touching read-only telemetry/SQL queries.
  • Hard Fail-Safe Latch Separation: Permanently blocks AI calls to `overwrite_ovp_threshold`, `disable_bms_thermal_latch`, or `force_relay_override` across all roles.

Run & Test Locally (Zero External Dependencies)

python3 -m unittest discover -s tools -p "test_*.py"
python3 tools/tool_use_rbac_guard.py --demo

Field Failure Mode vs. Spacebit Reference Fix

Field Failure ModeWhy Naïve Implementations BreakProduction Guardrail
Prompt injection requests restricted ERP dataLLM shares single admin DB credentialPer-caller RBAC allowlist checked outside LLM
AI proposes higher BMS over-voltage cutoffAI agent shares write access with firmwareHard-coded `FORBIDDEN_HW_MUTATION_TOOLS` block
Unstructured LLM guess misdiagnoses faultChatbot ungrounded from live time-series DBTyped SQL/telemetry read-only Tool-Use + citation ID

Full-Stack Architecture Guides & Source Modules