Skip to content

fix: let plugin pages run the actions their plugin may invoke - #2003

Open
ZacharyZcR wants to merge 1 commit into
Termix-SSH:dev-26.11.4from
ZacharyZcR:fix/frame-invoke-runs
Open

ZacharyZcR wants to merge 1 commit into
Termix-SSH:dev-26.11.4from
ZacharyZcR:fix/frame-invoke-runs

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Member

Fixes Termix-SSH/Plugin-Operations-Center#11.

Problem

Since 26.11.2 Operations Center draws in a frame. The frame policy's only run rule is POST ^/operations/{id}\.…/run$, so a frame can run only its own plugin's actions. Operations Center can't run any other plugin's action ("Not available to plugin views"), and its optionsFrom pickers stay empty. Automations' test runs hit the same rule.

Why not route runs through Operations Center's backend

ctx.operations.invoke works, but the run's origin becomes plugin / via. Two things then change for a person clicking Run:

  • builtIn approvals deny change/destructive runs from a plugin origin unless the via is trusted.
  • Approval rules written for ui stop matching.

History would also say the run came from a plugin, not from the person.

Change

checkCoreRequest takes the list of actions the plugin may invoke. The shell builds it from the manifest: operations:invoke plus contributes.operations.invokes, read with the SDK's own invokeAllowed.

A POST /operations/<action>/run for an action on that list is allowed with userAction: true. It goes out with the user's session, so the server sees ui and applies RBAC, approvals and history exactly as for the old in-shell view and the CLI.

This adds no authority. The same plugin can already run those actions as the current user from its backend, and the click check means a frame can't fire runs on its own.

Unchanged:

  • Plugins without operations:invoke, including the hostile-frame fixture, are refused as before.
  • The plugin's own actions keep the existing rule, with no click check.
  • frame-core-rules.json is untouched, so the mobile app's copy keeps refusing these runs until it adds the same check.

Tests

  • frame-policy.test.ts: runs on the invokes list (*, docker.*) are allowed with userAction. Refused: actions not on the list, an empty list, GET, cancel/approve paths, extra segments, encoded dots.
  • vitest run src/ui/tests/plugin-host/frames/: 192 tests pass. tsc -p tsconfig.app.json and eslint are clean.

Since plugin pages draw in frames, the frame policy only let one run its
own plugin's actions, so Operations Center could not run anything else or
fill optionsFrom pickers. A plugin with operations:invoke can already run
the actions in its invokes list from its backend, so its frame may run those
too, right after a click and as the person who clicked, which keeps the
origin, approval rules and history the same as the old in-shell view.
@termix-triage-bot

Copy link
Copy Markdown

AI review | Looks safe to merge

Allows framed plugins to execute actions listed in their manifest's operations:invoke capability, enforcing a user click requirement to prevent automatic execution. The change is safe, well-tested, and aligns with the plugin architecture.

Reviewed 966f3b9. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

This branch has not been deployed

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

Labels

None yet

Projects

Status: Open PRs

Development

Successfully merging this pull request may close these issues.

1 participant