ComfyUI Extension: ComfyUI-Ugromana

Authored by DayMan84

Created

Updated

3 stars

The next-generation security, governance, permissions, and multi‑user control system for ComfyUI.

Custom Nodes (0)

    README

    ComfyUI Usgromana

    <p align="center"> <img src="./web/assets/dark_logo_transparent.png" width="220" /> </p> <p align="center"> <strong>The next-generation security, governance, permissions, and multi‑user control system for ComfyUI.</strong> </p>

    Table of Contents

    1. Overview
    2. Key Features
    3. Architecture
    4. Installation
    5. Folder Structure
    6. RBAC Roles
    7. UI Enforcement Layer
    8. Workflow Protection
    9. IP Rules System
    10. User Environment Tools
    11. Settings Panel
    12. Backend Components
    13. Troubleshooting
    14. License

    Overview

    ComfyUI Usgromana is a comprehensive security layer that adds:

    • Role‑Based Access Control (RBAC)
    • UI element gating
    • Workflow save/delete blocking
    • Transparent user folder isolation
    • IP whitelist and blacklist enforcement
    • User environment management utilities
    • A modern administrative panel with multiple tabs
    • Dynamic theme integration with the ComfyUI dark mode
    • Live UI popups, toast notifications, and visual enforcement

    It replaces the older Sentinel system with a faster, cleaner, more modular architectureβ€”fully rewritten for reliability and future expansion.


    Key Features

    πŸ” RBAC Security

    Four roles: Admin, Power, User, Guest
    Each with configurable permissions stored in usgromana_groups.json.

    <p align="center"> <img src="./readme/UsgromanaLogin.png" /> </p>

    🚫 Save & Delete Workflow Blocking

    Non‑privileged roles cannot:

    • Save workflows
    • Export workflows
    • Overwrite existing workflows
    • Delete workflow files
    <p align="center"> <img src="./readme/AdminGroups.png" /> </p>

    All blocked actions trigger:

    • A server‑side 403
    • A UI toast popup explaining the denial

    πŸ‘οΈ Dynamic UI Enforcement

    Usgromana hides or disables:

    • Top‑menu items
    • Sidebar tabs
    • Settings categories
    • Extension panels
    • File menu operations

    Enforcement occurs every 1 second to catch late‑loading UI elements.

    🌐 IP Filtering System

    Complete backend implementation:

    • Whitelist mode
    • Blacklist mode
    • Live editing in Usgromana settings tab
    • Persistent storage via ip_filter.py

    πŸ—‚οΈ User Environment Tools

    From user_env.py:

    • Purge a user’s folders
    • List user-owned files
    • Promote user workflow to default (all user view)
    • Delete single user workflow
    • Toggle gallery‑folder mode
    <p align="center"> <img src="./readme/UserFiles.png" /> </p>

    πŸ–₯️ Transparent Themed Admin UI

    The administrative modal features:

    • Transparent blurred glass background
    • Neon accent tabs
    • Integrated logo watermark
    • Scrollable permission tables
    • Responsive layout

    πŸ”§ Watcher Middleware

    A new middleware that detects:

    • Forbidden workflow saves
    • Forbidden deletes
      And triggers UI-side toast popups through a custom fetch wrapper.

    Architecture

    ComfyUI
    β”‚
    β”œβ”€β”€ Usgromana Core
    β”‚   β”œβ”€β”€ access_control.py    β†’ RBAC, path blocking, folder isolation
    β”‚   β”œβ”€β”€ usgromana.py         β†’ Route setup, JWT, auth flows, settings API
    β”‚   β”œβ”€β”€ watcher.py           β†’ Intercepts 403 codes and triggers popups
    β”‚   β”œβ”€β”€ utils/
    β”‚   β”‚   β”œβ”€β”€ ip_filter.py     β†’ Whitelist/blacklist system
    β”‚   β”‚   β”œβ”€β”€ user_env.py      β†’ User folder management
    β”‚   β”‚   β”œβ”€β”€ sanitizer.py     β†’ Input scrubbing
    β”‚   β”‚   β”œβ”€β”€ logger.py        β†’ Logging hooks
    β”‚   β”‚   └── timeout.py       β†’ Rate limiting
    β”‚   └── web/
    β”‚       β”œβ”€β”€ js/usgromana_settings.js β†’ UI enforcement + settings panel
    β”‚       β”œβ”€β”€ css/usgromana.css        β†’ Themed UI
    β”‚       └── assets/dark_logo_transparent.png
    β”‚
    └── ComfyUI (upstream)
    

    Installation

    1. Extract Usgromana into:
    ComfyUI/custom_nodes/Usgromana/
    
    1. Restart ComfyUI.

    2. On first launch, register the initial admin.

    3. Open settings β†’ Usgromana to configure.


    Folder Structure

    Usgromana/
    β”‚
    β”œβ”€β”€ access_control.py
    β”œβ”€β”€ usgromana.py
    β”‚
    β”œβ”€β”€ utils/
    β”‚   β”œβ”€β”€ ip_filter.py
    β”‚   β”œβ”€β”€ user_env.py
    β”‚   β”œβ”€β”€ watcher.py
    β”‚   └── sanitizer.py
    β”‚
    β”œβ”€β”€ web/
    β”‚   β”œβ”€β”€ js/usgromana_settings.js
    β”‚   β”œβ”€β”€ css/usgromana.css
    β”‚   └── assets/dark_logo_transparent.png
    β”‚
    └── users/
        β”œβ”€β”€ users.json
        └── usgromana_groups.json
    

    RBAC Roles

    | Role | Description | |------|-------------| | Admin | Full access to all ComfyUI and Usgromana features. | | Power | Elevated user with additional permissions but no admin panel access. | | User | Standard user who can run workflows but cannot modify system behavior. | | Guest | Fully restricted by defaultβ€”cannot run, upload, save, or manage. |

    Permissions are stored in:

    users/usgromana_groups.json
    

    and editable through the settings panel.


    UI Enforcement Layer

    Usgromana dynamically modifies the UI by:

    • Injecting CSS rules to hide elements
    • Removing menu entries (Save, Load, Manage Extensions)
    • Blocking iTools, Crystools, rgthree, ImpactPack for restricted roles
    • Guarding PrimeVue dialogs (Save workflow warnings)
    • Intercepting hotkeys (Ctrl+S, Ctrl+O)

    All logic is contained in:

    web/js/usgromana_settings.js
    

    Workflow Protection

    If a user lacking permission tries to save:

    1. Backend blocks the operation (can_modify_workflows)
    2. watcher.py detects the 403 with code "WORKFLOW_SAVE_DENIED"
    3. UI shows a centered toast popup:

      β€œYou do not have permission to save workflows.”

    Same for delete operations.


    IP Rules System

    Located in:

    utils/ip_filter.py
    

    Features

    • Whitelist mode: Only listed IPs allowed
    • Blacklist mode: Block specific IPs
    • Configurable through new β€œIP Rules” tab in settings
    • Changes applied instantly to middleware

    User Environment Tools

    From:

    utils/user_env.py
    

    Features:

    • Purge a user’s input/output/temp folders
    • List all user-bound files
    • Toggle whether their folder functions as a gallery

    Exposed through the β€œUser Env” tab in the Usgromana settings modal.


    Settings Panel

    Access via: Settings β†’ Usgromana

    Tabs:

    1. Users & Roles
    2. Permissions & UI
    3. IP Rules
    4. User Environment

    Additional UI Features

    • Integrated logout button in the settings entry
    • Transparent blurred panel
    • Neon-accented tab bar
    • Logo watermark in top-right

    Backend Components

    access_control.py

    • Folder isolation
    • RBAC
    • Middleware for blocking paths
    • Workflow protection
    • Extension gating

    usgromana.py

    • All routes /usgromana/api/*
    • JWT auth handling
    • Registration & login flows
    • Guest login

    watcher.py

    • Intercepts 403s
    • Sends structured JS events

    ip_filter.py

    • Whitelist & blacklist logic
    • Persistent storage

    user_env.py

    • Folder operations
    • Metadata tools

    Troubleshooting

    Missing Logo

    Ensure the file exists:

    Usgromana/web/assets/dark_logo_transparent.png
    

    UI Not Updating

    Clear browser cache or disable caching dev tools.

    Guest cannot run workflows

    Check:

    can_run = true
    

    in usgromana_groups.json.


    License

    MIT License
    You may modify and redistribute freely.


    Changelog β€” ComfyUI Usgromana

    All notable changes to ComfyUI Usgromana are documented here.
    This project follows a semantic-style versioning flow adapted for active development.


    **v1.7.0 - Updated extension logic & added sfw toggle

    πŸ› οΈ Admin User group Extension list

    • Resolved an issue which caused duplicate extensions to be listed
    • List now accounts for explicitly listed extensions

    πŸ› οΈ Per user SFW reactor intercept (Highly experimental)

    • Admin can now toggle SFW on/off per user
    • utils/reactor_sfw_intercept.py (added new file)

    **v1.6.0 - Refactor & update User Workflow Administration

    πŸ“‚ User Files Additions

    • Monolith Addition: Added options to select and delete individual files & Promote Workflows
      • routes/user.py (Updated information passage)
      • web/usgromana_settings.js (updated the middleware and UI architecture)

    v1.5.0 β€” Modular Refactor & Architecture Overhaul (2025-12-6)

    πŸ—οΈ Architectural Refactor

    • Monolith Split: Deconstructed the massive usgromana.py into modular route handlers:
      • routes/auth.py (Login/Register/Token)
      • routes/admin.py (User & Group management)
      • routes/user.py (User environment & status)
      • routes/static.py (Asset serving)
    • Circular Dependency Resolution: Introduced globals.py to handle shared server instances and constants.py to centralize configuration paths.
    • Logic Decoupling: Moved business logic out of HTTP handlers into dedicated utilities (utils/admin_logic.py, utils/json_utils.py, utils/bootstrap.py).

    πŸ› οΈ Stability & Fixes

    • Startup Resilience: Added auto-creation logic for missing static folders (web/css, web/js, web/html) to prevent aiohttp crash on first run.
    • Windows Pathing: Fixed FileNotFoundError and path resolution issues on Windows environments.
    • Middleware Fixes: Restored missing create_folder_access_control_middleware and fixed import errors in watcher.py.
    • Config Correction: Resolved missing MAX_TOKEN_EXPIRE_MINUTES constant that prevented server startup.

    πŸ“‚ Frontend Reorganization

    • Restructured web/ directory for cleaner separation of concerns.
    • Consolidated ComfyUI extension scripts (usgromana_settings.js, logout.js, injectCSS.js) to ensure reliable auto-loading.
    • Moved HTML templates to web/html/ and updated static route mappings.
    • Removed legacy admin.js to prevent conflicts with the integrated Settings UI.

    v1.4.0 β€” Major Security & UI Expansion

    πŸ”₯ New Features

    • Added multi-tab Usgromana Settings Panel
      • Users & Roles
      • Permissions & UI
      • IP Rules
      • User Environment
    • Introduced logout button inside Usgromana settings.
    • Implemented transparent glass UI theme with background blur.
    • Added Usgromana logo watermark support in upper-right corner.

    πŸ” Security Enhancements

    • Full save/delete workflow blocking for restricted roles.
    • New watcher.py middleware to detect backend 403s and send structured UI warnings.
    • Unified blocking under WORKFLOW_SAVE_DENIED and WORKFLOW_DELETE_DENIED codes.
    • Strengthened RBAC defaults for guest accounts.
    • Added extension UI gating via CSS + runtime menu removal.

    🧠 Backend Improvements

    • New IP filtering system (ip_filter.py) with whitelist + blacklist modes.
    • New User Environment tools (user_env.py) including:
      • Folder purge
      • File listing
      • Gallery-mode toggles
    • Added create_usgromana_middleware() unified security layer.
    • Path blocking now includes extension routes, workflow endpoints, manager access, and asset paths.

    v1.3.0 β€” UI Enforcement Engine Overhaul

    ✨ Enhancements

    • Added dynamic scanning of:
      • PrimeVue menus
      • Sidebar buttons
      • Settings categories
    • Enforcement now applies every second to catch late UI loads.
    • Added hotkey interception (Ctrl+S / Ctrl+O) for restricted roles.
    • Rebuilt patchSaveConfirmDialog to override PrimeVue dialogs.

    πŸ›  Stability Updates

    • Resolved issues where guests could open extension settings.
    • Added safe defaults for undefined permissions per role.

    v1.2.0 β€” Folder Isolation & User Paths

    πŸ”§ New Features

    • Added per-user:
      • input directory
      • output directory
      • temp directory
    • Automatic directory creation with fallback to β€œpublic” user.
    • Added filename_prefix rewriting for isolated naming.

    🐞 Fixes

    • Corrected queue ownership tracking.
    • Fixed history objects containing mixed-user entries.

    v1.1.0 β€” JWT Authentication Integration

    πŸš€ Additions

    • Added JWT login, registration, expiration, and cookie storage.
    • Implemented guest login with auto-created β€œguest” user.
    • Created protections to ensure guest cannot escalate privileges.

    βš™ Backend

    • Refactored user database operations.
    • Added detection for first-time admin setup.

    v1.0.0 β€” Initial Release

    • Base RBAC system
    • Permission flags stored in usgromana_groups.json
    • Middleware for execution, upload, manager access
    • Basic UI blocking
    • Initial Usgromana settings entry (pre-tabs)

    Upcoming Features (Planned for v1.5+)

    • Live audit logging panel
    • Real-time session viewer
    • Admin ability to force logout users
    • Per-user storage quotas
    • Automated workflow sandboxing
    • Theme customization panel