mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
Integrates two community contributions into release/v3.8.8 with security hardening and conflict resolution. - **Plugins framework** (#2913 — thanks @oyi77): hooks + registry unification, plugin SDK (`definePlugin`), worker-thread sandbox, per-plugin hook rate limiting, SHA-256 integrity verification, semver-gated upgrade, and execution analytics. Plugin routes are loopback-only (`isLocalOnlyPath`); `child_process` exec is opt-in via `OMNIROUTE_PLUGINS_ALLOW_EXEC` (default off). - **API key option: disable non-published models** (#3017 — thanks @androw): a per-key flag restricting the key to discovered public models (combos / `auto/*` / `qtSd/*` routing still allowed). Hardening applied during integration: migration renumber (089/090/091), `/api/plugins` LOCAL_ONLY route-guard classification (closes the plugin-RCE vector), atomic install/upgrade with path containment, `O_EXCL` tmp-file creation (TOCTOU), rate-limit-map eviction, `validatePluginConfig` on configure, `buildErrorBody` on all plugin error paths. 246/246 tests; typecheck / cycles / docs-sync clean. Co-authored-by: oyi77 <14921983+oyi77@users.noreply.github.com> Co-authored-by: Nicolas Lorin <androw95220@gmail.com>
24 lines
1.1 KiB
SQL
24 lines
1.1 KiB
SQL
-- Migration 091: plugin_analytics — per-execution records for plugin hooks.
|
|
--
|
|
-- PR #2913 (plugin framework). The original PR shipped this table only as a
|
|
-- non-canonical stray under db/migrations/079_plugin_analytics.sql (a path the
|
|
-- migration runner does not read) and its tests created the table inline, so
|
|
-- recordPluginExecution()/getPluginAnalytics() in src/lib/db/plugins.ts would
|
|
-- fail at runtime in production ("no such table: plugin_analytics"). This
|
|
-- canonical migration creates it. Idempotent: safe to run more than once.
|
|
--
|
|
-- Schema matches src/lib/db/plugins.ts (INSERT/SELECT columns) exactly.
|
|
|
|
CREATE TABLE IF NOT EXISTS plugin_analytics (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
plugin_name TEXT NOT NULL,
|
|
hook TEXT NOT NULL,
|
|
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
success INTEGER NOT NULL DEFAULT 1,
|
|
error_message TEXT,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_plugin_analytics_name ON plugin_analytics(plugin_name);
|
|
CREATE INDEX IF NOT EXISTS idx_plugin_analytics_created ON plugin_analytics(created_at);
|