Skip to content

[CTX-1324] fix(security): triage synchronous input-to-plugin VM dispatch #2213

Closed

Description

@Xuepoo

Priority: P1 | Area: security | Labels: fix,P1,area:security | Milestone: 0.0.24 | RFC: P0-AC-015 / security overview invariant 4 | Task: CTX-1324

Source concern

For an enabled, active plugin with an ordinary valid mounted command binding,
the current application input callback can execute the owning plugin VM before
returning. This is the existing-source Major follow-up S1 from the independent
CTX-1321 review; it is separate from deferred UI vocabulary/style expansion.

At Core 4d1b2596d3b69a54224d18af871f826f1bb6a1c6:

  1. crates/bitty-terminal/src/terminal_app.rs:2796 routes a platform event into
    Runtime. Matching band release or bound wheel classification queues a request
    (crates/bitty-runtime/src/runtime/input.rs:934, :1542).
  2. The same handle_event invocation drains band clicks at
    terminal_app.rs:2832 and scrolls at :2840.
  3. dispatch_band_click / dispatch_band_scroll call
    PluginRuntime::dispatch_command (:1889, :1941), which calls
    vm.call_function synchronously at
    crates/bitty-runtime/src/plugin_runtime/mod.rs:2673.

The inspected application/routing/VM blobs are identical at PR #2211 head
c85f94b0f02e93a9daae5d9b8225742c648e1a10 and PR #2212 head
d23def8f697cb864046fda8de9ba3fbb7082fce6. Those unrelated fixes do not remove
this path. Static keybinding command invocation also reaches the same VM through
the application intercept; a band-only fix cannot claim all-input exclusion.

Shared canonical security at 55f540a8c7236e757b6f4cbf21a4c3ce49e92327 makes
input hot-path exclusion normative through overview invariant 4 and P0-AC-015.
Per-callback budgets, bounded queues and command/host capability checks remain
important controls but do not substitute for this scheduling requirement.

Evidence limits and 0.0.24 assessment

This is source inspection only. No application, plugin callback, hostile probe,
VM, clipboard/display/native operation, build, latency probe or released artifact
was executed or verified. No measured stall, exploit, capability escalation or
exact artifact reachability is claimed. Ordinary host-operation grants remain in
place. No canonical risk status or finding severity is changed here.

P0-AC-015 is not demonstrated and its architecture condition is contradicted by
the inspected valid band-input path. An explicit 0.0.24 release-owner/security
disposition is required before calling that control passed or release-ready.
The historical R-007 Mitigated record does not verify this later path. This issue
does not automatically waive/escalate the finding or authorize release-state,
tag, publication, scheduler, origin DTO or invalidation changes.

Smallest next slice and acceptance

  • Independently review the source packet under
    recording/release-input-vm-triage/ (Core CTX-1324).
  • Authorize a separate finite regression through the actual application's
    AppHandler::handle_event: a tiny real callback, actual Runtime routing,
    owning-VM entry counters before/after input and a distinct cold pump. Assert
    zero VM entries during input, exactly-once later delivery, valid-command and
    fall-through positive controls, and unchanged consumed-release semantics.
    Existing dispatch-helper tests are insufficient. EventContext currently
    requires a real ActiveEventLoop, so explicitly scope a safe opt-in headless
    context and read-only VM counter accessor; no invalid context or live display.
  • Select a conforming bounded cold delivery mechanism with the responsible Core
    owner. Existing band queues/cold tick are possible seams, not an accepted
    scheduling decision. Preserve origin fences, live lifecycle/grant revalidation,
    registered command/schema checks, per-host-operation capabilities, queue and
    payload bounds, attribution, and paired input consumption.
  • Coordinate origin identity/DTO/invalidation with CTX-1321 and CTX-1299 / [plugins] Reconcile bounded Lua UI composition API and host parity #2191;
    click/scroll lineage is CTX-0946 and CTX-1190 / [ui] Scroll bindings for mounted plugin UI (on_scroll with step arg) #2008; command invocation lineage
    is CTX-1035 / Generic host-mediated command-invocation path (palette/keybinding to dispatch_command, deny-by-default) #1829; cold overlay pump lineage is [plugins] Composer open scene chrome + input pump #1972 / [ux] Host pump driver for overlay capture input (buffer-arrival) #2007. Do not duplicate
    their ownership or make broader UI expansion a prerequisite for triage.
  • Keep the P0 criterion unpassed until its required independent architecture and
    integration evidence is recorded. Have the canonical owner reconcile R-007
    evidence and record the release-control disposition. No mitigation or test is
    implemented by this issue.

Activity

  1. added this to the 0.0.24 milestone on Oct 17, 2026
  2. Xuepoo commented on Oct 17, 2026

    @Xuepoo
    ContributorAuthor

    CTX-1324 clarification following independent PX-7133 review, Minor finding F1:
    the proposed future regression must isolate Runtime construction as well as the
    application event context. At pinned Core
    4d1b2596d3b69a54224d18af871f826f1bb6a1c6, with_defaults and the deterministic
    rasterizer constructor reach initialization with Clipboard::new()
    (crates/bitty-runtime/src/runtime.rs:1669; the other constructor uses :1935).
    That attempts native initialization; replacing it later with
    force_headless_clipboard() does not prevent the attempt.

    Before the separately authorized regression, reuse a separately landed verified
    safe constructor if available, or obtain the additional exact source scope
    crates/bitty-runtime/src/runtime.rs for a narrow opt-in construction path
    selecting existing Clipboard::new_headless() before initialization, preserving
    production defaults and reusing deterministic rasterization/headless surface.
    Do not mutate process-global display variables or attempt a native fallback.
    The private recording EventContext with unchanged AppHandler signature and
    read-only own-VM entry counter (typed missing/busy outcomes), post-setup input
    baseline and separately driven cold exactly-once controls remain proposals.

    The author correction is recorded in
    recording/release-input-vm-triage/correction-ledger.md and
    f1/correction-report.md; original packet hashes are preserved in exclusive
    history. Independent re-review of F1 is pending. This clarification changes no
    issue scope into implementation authority and selects no API/scheduler. The full
    band and adjacent keybinding source concern remains: P0-AC-015 is unpassed and
    source-contradicted for the inspected band path, with 0.0.24 owner/security
    disposition unresolved. No measured stall, exploit, capability escalation or
    exact artifact proof is claimed. Fresh owner authorization remains required
    before tag/release publication.

  3. added
    P0Priority: highest
    and removed
    P1Priority: high
    on Oct 18, 2026
  4. Xuepoo commented on Oct 19, 2026

    @Xuepoo
    ContributorAuthor

    Partial slice landed in bb4c01ffff (PR #2236, CTX-1332), implementing only the accepted rows:

    • C-D1 + C-D4 + C-D5: band actions now pump only from AboutToWait, with a presented-origin fence, live pre-borrow validation, and eager cancellation that preserves the release swallow.
    • C-D6: #[doc(hidden)] Active-only dispatch_ui_command.
    • C-D9/C-D10: literal 16 selection bound; unselected work stays queued.
    • F7: chrome_band_versions() includes the band edge.

    Still open (this issue stays open):

    • Retained drive_tick VM pumps for timers, overlay released/input-available, and runtime events remain nonconforming. P0-AC-015 is not claimed.
    • C-D2/C-D3/C-D7/C-D8/C-D11 are proposals, not implemented; C-D12 hold stands.
    • No numeric aggregate budget, replenishment, or wall-time policy.
    • Live-window/real-surface publication, DPI/padding/stacking remaps, and recovery remain for a native campaign.
    • [P0] Bound native clipboard acquisition before allocation and delivery #2206/R-004 remains a separate P0.

    Evidence: recording/ctx-1332-cold-delivery/ and its independent review; CI includes a feature-on phase gate covering AboutToWait, redraw, PTY-readable, resize, appearance, and headless Resumed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Priority: highestarea:securityArea: security corpus / auditfixBug fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions