provide-terminal 2026-04-04
Code review: rate-limit bypass fix, hub encapsulation, shell vendor tree, type safety
46 files · 2,142+ · 781-

Rate-limit bypass fix and auth hardening

3 files changed
  • rate_limit.py Check global rate-limit bucket before per-client bucket — fixes bypass via short-circuit eval order
  • config.py Require auth.header_mode_acknowledged for header auth mode
  • entry.py Narrow except Exception to except ImportError
  • Rate-limit bypass fixed: global bucket now checked before per-client bucket in allow_rest_acquire_for and allow_rest_send_for, preventing per-client bucket from short-circuiting the global limit. Header auth mode requires explicit header_mode_acknowledged flag. CF entry except clause narrowed from Exception to ImportError. harden behavioral
    1 file
    • rate_limit.py

TermHub encapsulation: public API replaces direct internal access

2 files changed
  • core.py Add public TermHub methods: get_idle_candidates, resume_store, set_browser_role, try_reclaim_hijack, get_worker_browser_role
  • connections.py Hub internals accessed via public methods instead of _lock/_workers
  • TermHub gains public methods (get_idle_candidates, resume_store, set_browser_role, try_reclaim_hijack, get_worker_browser_role) replacing direct _lock/_workers access from app.py, websockets.py, and browser_handlers.py. SessionRegistry gets public get_runtime() method. streamline internal
    1 file
    • core.py

Shell vendor tree, type safety, test fixes

3 files changed
  • __main__.py CF vendor tree for provide-terminal-shell: __main__, _commands, _output, _render, _repl, _sandbox, terminal connector
  • test_connector.py PAM integration: replace cast-from-object with TYPE_CHECKING types
  • run_demo.py Fix broken import hijack.hub → bridge.hub; extract demo port constants
  • Restore CF vendor tree for provide-terminal-shell (dropped during rename). Replace cast-from-object pattern with TYPE_CHECKING types in PAM integration. Fix broken demo import (hijack.hub → bridge.hub). Add EventBus._compile_pattern regex validation. Add OBJC_DISABLE_INITIALIZE_FORK_SAFETY to root conftest for macOS. Install pytest-textual-snapshot, regenerate watch app snapshots. Declare provide-terminal-tunnel as server dependency. Add CLAUDE.md. remediate internal
    2 files
    • run_demo.py
    • test_connector.py