Install scanner (tools/plugin_guard*, PLUGIN_SCANNER_VERSION bumped once):
- hardcoded_secret: a PostHog project key (phc_, write-only ingest key) joins the
Google installed-app secret as a public client key -> high (caution), only
when every matched literal on the line has a public prefix (telesec
telemetry.py:27 was dangerous). phx_ personal keys and any other token stay
critical.
- proc_access: reads of /proc/self|<pid>/{cgroup,mountinfo,stat,status,...}
(container placement, pid start time) land at low instead of high
(hermes-lcm-x cpu_capacity.py was caution). environ, cmdline, mem, maps, fd,
root/cwd, ns, bare /proc/self, any unlisted leaf and any write keep high.
Generalises #144304's cgroup/mountinfo allowance and keeps the finding
visible instead of dropping it.
- bytecode_file: a committed .pyc/.pyo (git ls-files; plus any bytecode outside
__pycache__) is a high structural finding, the binary_file tier (rule 17;
hermes-emotion shipped tests/__pycache__/*.pyc and scanned safe). Untracked
caches the validate run writes are not flagged.
Validator (hermes plugins validate, warnings only):
- private imports: gateway.session_context.get_session_env is the documented
route (plugins/index.md) and a plugin's fallback import of its own install
path (plugins.memory.openltm._db) is not a core import.
- new warning for private-method calls on core handles (SessionDB, AIAgent,
GatewayRunner, PluginContext) the plugin does not define itself
(opencode-sync db._execute_write, runner._evict_cached_agent).
- desktop surface review warning for raw window.hermesDesktop calls and app
markup selectors ([data-slot], [data-tree-*], [data-pane-host]) in CSS text
or closest() (squad-hub, novel-reader, search-sources).
A catalog plugin that queries or creates a `<webview>` scripts the preview
page without declaring `preview.executeJavaScript` or asking the user.
Admission now fails it as "preview guest reach"; `ctx.preview` stays clean.
The rule could not tell a bundled library's own classes from patching a renderer global: it kept
failing legitimate bundles (three.js once minified to $-names) and still missed a bare $ receiver.
Prototype writes in a Desktop plugin are now read by the catalog reviewer instead; the policy in the
catalog docs stays, with a note that review checks it by hand. eval/new Function, non-SDK imports,
script injection and app-DOM reach are still linted.
An expression must follow return/typeof/throw/etc., so a `/` there can only
open a regex; offering the division reading left the regex text visible and
refused `return /Track = vector/` as a rebinding of Track. `of` keeps both
readings because it is also a plain identifier.
- After `)` or `}` a `/` can open a regex or be division; picking either
one lets a crafted literal hide code (a quote inside `if (x) /"/` blanked
the patch after it). The scanner now follows every legal reading at once
and blanks a character only when ALL live readings agree it is literal
text. The true reading is always among them, so executable code is never
blanked; a regex after `if (...)` is also read correctly again.
- In a destructuring pattern, a class name used only as a key
(`{Track: value} = o`) is not a rebinding of Track.
- A destructuring assignment after `?`, `:`, `&&`, `||`, `!`, return, yield
or void now counts as rebinding X (`c ? [S] = [window.Storage] : 0`).
- Drop the if-condition regex heuristic: it scanned raw text backwards, so
`Number("if (") / (Storage.prototype.x = spy) / 3` read as a regex and the
patch between the slashes was blanked. Every ambiguity now resolves toward
scanning as code: a wrong guess there only refuses a bundle for review,
while a wrong guess the other way hides a patch.
- `registry[Track.name] = Track` read as a destructuring pattern naming Track.
A pattern now has to open where an expression cannot (start of statement,
after = ( , or let/const/var) and name X itself, not X.name.
- The scanner read any `/` after `)` as division, so a regex statement after
`if (ready)` was scanned as code. A `)` that closes an if/while/for/with
condition now lets a regex literal start.
- A destructuring ASSIGNMENT (`({S} = o)`, `[S] = a`), compound assignment
(`S ||= x`), `for (S of ...)` and import bindings now count as rebinding S.
- The literal mask blanked whole template literals (hiding code in `${...}`)
and treated `/ (...) /` division as a regex (hiding the code between). It
is now a small scanner: string and template TEXT is blanked, `${...}` stays
code, and `/` opens a regex only where an expression cannot end before it.
The rebinding check read any `(X)` or `, X)` as a binding, so
`register(Track); Track.prototype.x = ...` failed admission, and it scanned
unmasked source, so a label like "Track = vector" did too. A rebinding is now
only an assignment, a let/const/var/class/function declaration, a destructuring
declaration, or a parameter (function, method, arrow, catch), matched on source
with strings and regex literals masked.
Greptile (3/5) held the PR because aliases could still borrow an unrelated
class name: the alias list enumerated spellings, and window["Storage"] or
(0, window.Storage) were not on it. Enumerating spellings cannot be finished,
so the rule flips: X.prototype.y = passes only inside the body of class X /
function X, or after a class X / function X / var X = class statement in the
same block, with no rebinding of X in between. Everything else fails,
whatever the alias looks like. This also holds for minified bundles that reuse
one-letter names (three.js minified: class s{...s.prototype.isVector2=!0}).
three.module.js, three.core.js and the minified Meshy bundle: 0 findings.
The alias rule treated any `{ Array: Track }` object literal as destructuring
from a renderer global, so a bundled library keeping a type registry was refused
for writing its own Track.prototype. Destructuring now counts only when the
source is window/globalThis/self.
The declared-name set is file-wide, so `function u() { class S {} }` excused
`const S = window.Storage; S.prototype.setItem = ...` (Greptile review). Any name
bound to a renderer global (`X = Storage`, `X = window.Storage`,
`{ Storage: X } = window`) now always fails, like the global itself. The three.js
bundles still pass.
The "prototype patching" admission rule matched any `X.prototype.y =` line. A
bundled library setting fields on classes it declares itself trips it: three.js
alone hits it 29 times (`var Vector2 = class _Vector2 { constructor() {
_Vector2.prototype.isVector2 = true } }`, `KeyframeTrack.prototype.ValueTypeName
= ...`), so no Desktop plugin could ship a three.js viewer.
The write now fails only when the receiver is not a class/function the file
declares, or is a renderer/browser global (Storage, HTMLElement, Array, ...),
which keeps failing even when the file shadows it with a same-named class (a
regex cannot see scope). Every attack shape the rule exists for still fails:
`Storage.prototype.setItem = ...`, an alias of a global, a shadowed global.
Greptile on #141510: platform secrets (MATRIX_PASSWORD, DINGTALK_CLIENT_SECRET) passed the
client-variable check, so it now uses is_registered_env_name like the rest of config. Uninstall
deleted grants by manifest key while sign-in stores them by directory key; both use plugin_key
now. A core resolver's own refresh POST (Codex) could raise httpx with the refresh-token request
attached; that is rebuilt too. Logout no longer needs a valid oauth: entry, a numeric id is
refused instead of accepted and unusable, and the host-domain warning keeps three labels for
two-letter country suffixes (vendor.co.uk).
FakeIdP can serve https with a throwaway CA (make_test_ca gains IP SANs) and bind a fixed
address, so the https-only rule is exercised for real; the fake browser runs in its own thread
like a real one. Folds the auth_commands routing test into the lifecycle test and the two re-pin
delta tests into one. New invariants, red on the PR head: errors reach the plugin without a
credential, a revoked grant keeps no tokens, uninstall drops the grant, unattended sign-in is
refused, http/loopback endpoints and Hermes-owned client variables fail validation.
- the resolver that returns the bearer is core-only (_plugin_oauth_spec),
like the _PROVIDERS resolvers; plugins go through
credentialed_provider_request
- a token endpoint answer counts only when it is 2xx: a redirect is a
failure, never a token
- `oauth:` given as a mapping fails instead of reading as undeclared
- an authorize or token URL with a fragment, a bad IPv6 literal or a bad
port is a validate problem instead of a crash
- plugin code is read as utf-8-sig when looking for the token URL
- tests: a refresh answered without a new refresh token keeps the old
one (Google does this), every field of the entry changes the
fingerprint, and the install notice command resolves a plugin whose
manifest name differs from its directory; the FakeIdP knob is now
token_answer, since it also answers 200
Refs #139077
A plugin that calls a third-party API with the user's own OAuth client
(Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml
instead of running the consent flow and keeping the refresh token itself.
- `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE
login of auth_oauth_pkce_plugin and keeps the grant in the active
profile's auth.json (section `plugin_oauth`, keyed by the plugin's key)
- `credentialed_provider_request(<id>, ...)` attaches the bearer for the
entry's declared hosts only (https, port 443) and refreshes the grant
under the auth-store lock; the calling plugin's own entry is resolved
before `_PROVIDERS`, so a later core provider of the same name cannot
take it over
- each grant stores a fingerprint of the entry it was made for: a plugin
version that changes the token URL, hosts, scopes or client variables
gets ProviderNotSignedIn until the user signs in again
- the client secret is read with get_secret right before each token POST
(OAuthPKCEConfig.token_request) and never sits in the frozen config
- grant-dead codes retire the grant; invalid_client, unauthorized_client
and invalid_scope surface as AuthError codes; a sign-in granted fewer
scopes than declared saves nothing
- `hermes plugins validate` checks the block and the declared variables
and warns when plugin code names the token URL; install/show notices
and the catalog re-pin consent delta list the entries
Refs #139077
6a031bf1b3 moved the probe to venv_command(root, selected_venv(root)); the test still patched only project_python, so on a runner without a repo venv it spawned a missing venv/bin/python (FileNotFoundError). It now patches the seam production reads.
The admission lint only scanned desktop/**/*.js, but the Desktop git installer (findDesktopEntry) prefers a repo-root plugin.js and publishes the root beside it, so root-layout plugins skipped the lint entirely.
hermes plugins validate --install-deps synced the plugin's declared
dependencies into a newly committed environment, then ran the capability
probe with sys.executable, the pre-sync interpreter. Plugins importing a
non-core package at load time (evalroute: pyyaml, gone from core since the
ruamel move) failed the catalog gate with a masked ImportError.
Run the probe with the committed environment's interpreter and activation
env. A developer venv without a committed environment keeps the old path.
The parameter-patcher pass recorded a method's rebinding parameter at its
index counting self, so a call site like self._patches.bind(module, name, fn)
was checked at args[1] (the attribute name) instead of args[0] (the module).
A plugin that routed every core rebind through a class helper passed the
gate with zero findings.
Catalog policy (Teknium): a listed plugin extends Hermes only through public
surfaces. A plugin that replaces core functions, methods or Desktop UI in place
collides with every other plugin patching the same seam and breaks on any core
release.
- New `no core override` admission check (hermes_cli/plugin_validate_core_override.py):
static taint pass over the import closure of __init__.py and dashboard/*.py.
Core values are Hermes modules (plus hermes_plugins.*) and attribute chains off
them, reached by import, importlib/sys.modules lookups, getattr, iteration, or a
plugin helper that returns one. Rebinds are attribute assignment/deletion,
setattr/delattr, sys.modules writes, writes into a core module's tables,
mock.patch, and passing a core value to a helper that setattr's its parameter.
Tests, benchmarks and CI/smoke scripts outside the import closure are not judged.
- Desktop lint: new `app DOM reach` rule (document-level queries of the app's own
data-slot/data-tour/data-sidebar/data-testid markup, and document.body
childList/subtree MutationObservers).
- Desktop lint bug: the comment stripper did not skip string literals, so a string
holding `/*` (a glob like '**/*.md') opened a fake comment and hid every line up
to the next `*/` from all rules. Strings are now matched first and kept.
- README rule 9, the plugin-catalog user guide and the plugin developer guide's
compatibility contract state the rule.
A/B over 466 pinned trees (121 open catalog PR entries + 349 listed entries +
humalike): the new checks flag exactly the hand-verified overrides; zero crashes;
no previously reported Desktop finding disappears.
Review finding (MAJOR-1): masking the first argument of every new RegExp(...)
also hid `el.innerHTML = new RegExp("<script src=x></script>").source`, a real
injection through .source — desktop_surface_findings returned 0 findings for
that line. The literal is now masked only when the constructor is the argument
of .replace/.replaceAll/.split/.match/.matchAll/.search or the receiver of
.test/.exec; every other use (.source, .toString(), template interpolation) is
a string-builder and keeps firing. The existing test gains the .source line
(must flag) and a .test() line (must not).
The regex-literal form was already masked (50e9cd7bd5); rss-reader
(#115972, desktop/plugin.js:2577) still ships "<scr"+"ipt" split strings
because the same sanitiser spelled for a dynamic flag — the string handed
straight to new RegExp( — kept scoring as 'script injection'. Mask only
that first-argument literal; a '<script' string written into the DOM and
createElement('script') + .src= still fail.
Part of #116305 (item 10).
Conflict resolutions and semantic fixups:
- tools/environments/base.py: main's hard-exit kill fence (kill a spawn the
fence missed, deregister from _live_foreground in a finally) wrapped around
pm-clean's output collector.
- pyproject.toml: pm-clean's marker list plus main's new `live` marker.
- hermes_cli/main.py: pm-clean runs startup recovery from hermes_bootstrap, so
the old early-recovery block stays gone; main's interrupted-pull restore
(auto-merged above it) runs right after bootstrap, as on main.
- hermes_cli/update_cmd.py: main's interrupted-pull marker now guards
pm-clean's first tree mutation (release-tag detach, ff-only, or reconcile)
and is cleared once git is done. The marker's target is the ref git actually
moves to (a release tag, not always origin/<branch>), since the restore
compares against it.
- hermes_cli/_early_recovery.py: restore `import subprocess`, which pm-clean
had dropped and main's auto-merged restore needs (NameError on the first
launch after a killed update; test_update_interrupted_pull red -> green).
- apps/desktop/src/i18n/{de,es,fr}.ts: main's new locales carry the full
settings.about block; trim it to `updates` as pm-clean's type and the other
overlays do (tsc: 27 errors -> 0).
- main's new e2e tests: `import yaml` -> hermes_yaml; wake-word import table
names pyopen_wakeword (pm-clean's wake-openwakeword extra); the anthropic
key-leak switch leg needs the SDK, and the api_server two-tenant test needs
aiohttp, both PM runtime extras the test env does not carry.
`hermes plugins validate` kept a private `_CONFIG_TYPES` copy that never learned
`secret` (or `object`) when the manifest loader and the Desktop settings renderer
did, so catalog admission (`pinned-source-validate`) went red for any plugin that
declares a `type: secret` setting — the documented way to surface an API key in
the Plugins tab (#120088 web-search-plus 4.3.0, #120492 browserclaw 3.1.0).
Derive the admission set from `plugins_manifest._CONFIG_SCHEMA_TYPES` so the three
cannot drift again; `mapping`/`map`, which only the validator ever accepted (the
loader warned "unknown type" on every load), are no longer admitted.
Change-detectors, tautologies, source-reading tests, redundant duplicates,
mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane
ledger (category + reason for every removal).
The 'dynamic import outside the SDK' rule matched only import(); a static import 'https://…' passed admission while being the same one-line second stage. New rule 'remote import outside the SDK' mirrors the loader's allowlist so review and the app agree.
Branch semantics kept where main and PM disagree: update_cmd_deps.py,
constraints-termux.txt, the Electron update-api-check module and the
post-swap hand-off test stay deleted; the pending-fleet-restart catch-up
and the local_runtime tag/download ladder stay retired (PM owns engines).
Ported from main onto the branch's shape: profile_scoped_chore for the
auto-archive and plugin-update housekeeping chores, the local-runtime
cross-process boot lock and residency cap, the checkpoint tmp_pack sweep,
the cua daemon-liveness status probe, the remote-served Desktop update
flag (posix.sh / windows.ps1), sign-in for env-pinned remote gateways
(urlDisabled on RemoteSetupFields), the uvloop extra split (uvicorn
without [standard]), and the umask-scoping spawn test.
uv.lock regenerated with pm.build_env --lock-only; new utf-8 reads from
main switched to utf-8-sig (check-windows-footguns).
Real catalog pins from the 2026-09-20 intake batch scored on text that cannot run on
the installing host:
1. `.github/workflows/*.yml` — a CI step's own `os.environ['RUNNER_TEMP']` read scored
`python_os_environ/high` and made a clean plugin `caution` (remarkable). A workflow
runs on the forge's runner; it now takes the README prose cap (one step down,
agent-facing shapes like `curl | sh` keep full severity).
2. "pip install" inside a user-facing message literal (`"... no pip install is needed"`,
image-utils) scored `unpinned_pip_install/medium`; mid-literal, non-command position,
no exec verb on the line → low. `"pip install x"`, `python -m pip install`, `uv pip`,
`subprocess.run("pip install …")` keep medium.
3. `desktop_surface_findings()` was being run by batch tooling over every `*.js`/`*.mjs`
in a repo and flagged a Node sidecar's lazy `import('jszip')` (remarkable). The
product check was already scoped to `desktop/`; expose that scope as
`is_desktop_surface()` / `desktop_surface_hits()` so tooling shares it.
4. `127.0.0.1:<port>` (README, .mcp.json, client defaults) scored `hardcoded_ip_port` as
network egress; a line whose every IP:port is loopback → low. A routable address on
the line keeps medium.
Every finding stays in the report. PLUGIN_SCANNER_VERSION → plugin-guard-v8 so cached
verdicts on quarantined pins are re-evaluated.
Resolved toward the branch: PM provisions uv/python (main's install.ps1 uv-shim
salvage + its test and workflow steps dropped), the shim re-exec stays retired,
package.json carries no electron-builder block (afterExtract identity stamp wired
into electron-builder.config.cjs instead; after-pack.mjs keeps signing only),
Desktop workspace-deps helpers stay retired. Main's scratch-dir bootstrap
(export_scratch_tmp_env) is taken and re-run after profile resolution.
Desktop lint: /<script[\s\S]*?<\/script>/gi in a feed sanitiser scored as
'script injection' and failed pinned-source-validate for rss-reader. Mask
JS regex literals for the markup-shaped rule only; <script in a string
literal (an innerHTML payload) and createElement('script') still fail.
Install scanner: "printenv" as a whole-string entry of a read-only
allowlist (frozenset({..., "printenv"})) fired dump_all_env high →
caution on hermes-jev. Extend the literal-token demotion: a token that is
the ENTIRE quoted literal on a line that executes nothing steps down like
an alternation member; "sudo" inside subprocess.run([...]) and
os.system("printenv") keep high.
A/B vs origin/main: attack probes identical (23 rows), in-tree sweep 319
entries 0 worse/0 changed; both new tests red on base. Bumps
PLUGIN_SCANNER_VERSION to v6 so cached caution verdicts refresh.
Signed-off-by: teknium1 <teknium1@users.noreply.github.com>
A desktop/plugin.js is evaluated in the Electron renderer with the app's
full authority; the runtime loader documents itself as error isolation
only and says a remote source must not reuse it without a boundary. The
catalog is that remote source, so admission now fails a plugin whose
desktop code patches prototypes, uses eval/new Function, dynamically
imports anything but the SDK (app chunks, blob/http URLs), or injects
script tags. Against the 18 desktop plugins in the current sweep the lint
passes 17 and fails the one the security review flagged for exactly these
moves. Policy written down in plugin-catalog/README.md rule 8 and the
user-facing catalog doc.
Reconcile plugin declarations and validation through PM's atomic generation publication; preserve external runtimes, target markers, and conflict refusal. Keep one source-update completion owner and port upstream lifecycle changes to the PM desktop/runtime paths.
Symptom: a third of catalog entries (23 of 71 pinned trees scanned today) could not be
installed from the Desktop. The install path runs plugin_guard on every clone and a
caution verdict needs a confirmation; the CLI prompts, the Desktop/dashboard path
passes no decision callback, so caution became "Security scan blocked".
Root cause: admission (hermes plugins validate + catalog CI) never ran the scanner, so a
pin could be approved by a human and still trip the installer.
Fix, both halves:
- validate_plugin_dir gains a "security scan" check: dangerous fails the entry, caution
is reported as warnings so the reviewer reads the findings before merging the pin.
pinned-source-validate in plugin-catalog-ci.yml therefore runs the identical scanner.
- _install_plugin_core accepts reviewed_pin=<catalog sha>; when the checked-out revision
equals it, caution is accepted without a prompt. dangerous still blocks (a signature
added after review is what the backstop is for). Raw-URL installs, --ref overrides
and a checkout at any other revision keep the current behaviour.
Live: dashboard_install_plugin('weather') on origin/main -> BLOCKED caution; after -> ok.
Two false positives in `hermes plugins validate` that block catalog admission
for plugins that are correct at runtime:
- `kind: model-provider` plugins register at import via
providers.register_provider(ProviderProfile); the PluginManager never calls a
register(ctx) on them (plugins_discovery skips the kind). The probe demanded
register() anyway, so every provider plugin -- including the in-tree
plugins/model-providers/* -- failed with "no register() function". The probe
now records register_provider calls for that kind and fails only when the
import registers nothing.
- RecordingContext returned a no-op callable for ANY attribute, so
`getattr(ctx, "profile_path", None)` was truthy under validation alone and
register() crashed with an error the real PluginContext never produces. The
parent now passes the real PluginContext method names into the probe; other
names raise AttributeError exactly like the real object.
Surfaced by the 2026-09-15 catalog sweep (Gondola provider, hermes-persona).
Preserve upstream fixes without restoring retired dependency installers.
Run configured-feature checks in the selected build interpreter. Reuse a
supported base Python during bootstrap, and preserve durable backup media.
Refresh the dependency lock through PM. Keep the frozen historical import
surface unchanged. Adapt incoming native tests to the platform markers.
Verification: the incoming 86-file pass found two fixture mismatches;
both passed after correction. Targeted PM/update/compatibility checks,
Electron and renderer typechecks, and desktop tests passed.
Native Windows/macOS update journeys and the full suite remain unrun.
Companion to the import fix: a clause whose version segment does not parse
(`>=0.21.1,<0.x`) must fail admission rather than silently gate nothing.
Salvage note: the source hunk (same import fix) and the duplicate positive
test from PR #108842 were dropped in favour of the earlier #107553; only the
negative test is carried here.
Activation reaches plugin discovery before the application dependencies
exist. Give PM its own locked Python project and runtime so it can install
or repair the application without importing that dependency tree.
Keep PM outside the application workspace. A shared uv workspace resolves
the application graph and cannot provide this isolation. Route mutations
through an isolated worker and preserve transaction callbacks, cancellation,
custom package registrations, and correlated receipts.
Use the same runtime builder for source installs and packaged payloads.
Keep offline wheelhouse support in that builder. Nix builds the independent
PM lock as a separate derivation. Refuse lazy-disabled bootstrap before
installing tools or dependencies.
Move first-party YAML readers and writers to ruamel. Keep the application
lock's transitive PyYAML requirements for third-party packages.
Verification:
- Focused canonical Python suite: 177 passed, 1 host-gated skip.
- Electron backend probes: 12 passed. Electron typecheck passed.
- Both uv locks, scoped lint, Bash syntax, and whitespace checks passed.
- Cold activation, corrupt-app repair, offline staging, and relocation ran.
- Built and exercised the Nix PM runtime and standalone YAML merge script.
Six broader caller test files retain the same 24 failing test IDs as an
archive of HEAD. The existing real-home guard blocks those tests before
they can exercise the affected paths. No full-suite pass is claimed.
Native Windows signing and full Bionic package execution remain unverified.
538+570+296+216 lines of change-detectors → 4 files of contract tests:
seed catalog valid, bad entries skipped, kill list name-or-repo, live
fallback+union; real-git pinned install + sidecar + re-pin; kill list
blocks CLI/dashboard/TUI with only the CLI bypass; dashboard merge via
sidecar; probe get_config default; extractor live document.