8 Commits

Author SHA1 Message Date
John McLear
90fd9b15b1
fix(plugins): updatePlugins.sh actually updates installed plugins (closes #6670) (#7644)
* fix(plugins): updatePlugins.sh actually updates installed plugins (#6670)

bin/updatePlugins.sh detected outdated plugins by running
`pnpm --filter ep_etherpad-lite outdated --depth=0`, but installed
plugins are not registered in src/package.json — bin/plugins.ts adds
them via linkInstaller.installPlugin which writes to
src/plugin_packages/.versions/<name>@<version>/ and tracks the result
in var/installed_plugins.json. pnpm has no view of them, so `outdated`
returns empty and the script always reported "All plugins are
up-to-date" even when newer versions existed on the registry. PR #7468
fixed npm→pnpm and install→update but kept the same broken detection
mechanism, which is why the issue stayed open after that PR landed.

Read the plugin list from var/installed_plugins.json instead, then
re-invoke linkInstaller.installPlugin(name) for each entry. Calling
the installer without a version pin resolves the registry-latest and
overwrites the existing pinned copy, so an outdated plugin is brought
to head while plugins already at latest are no-ops apart from the
pnpm cache hit.

Add an `update`/`up` action to bin/plugins.ts so users can also run
`pnpm run plugins update` directly, mirroring the existing
install/remove/list actions. updatePlugins.sh becomes a one-line
wrapper for backwards compatibility.

Reproduction (verified):
    pnpm run install-plugins ep_markdown@11.0.5  # latest is 11.0.18
    ./bin/updatePlugins.sh                       # → 11.0.18

Edge cases tested: no plugins installed, missing installed_plugins.json,
already-at-latest re-run.

Closes #6670.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(plugins): validate ep_ prefix and dedupe + add regression test

Qodo flagged two issues on the original update() addition:

  1. Security — update() trusted every name in var/installed_plugins.json,
     so a corrupted or hand-edited manifest could coerce the script into
     installing arbitrary npm packages. pluginfw/plugins.getPackages
     already gates on the ep_ prefix; mirror that gate here.
  2. Reliability — no automated regression test, so a future refactor
     could silently bring back the broken behaviour.

Extract the safe-name filter to filterUpdatablePluginNames in
bin/commonPlugins.ts (pure, side-effect-free, prefix configurable, also
de-duplicates repeats so a duplicated entry installs once). Use it from
plugins.ts update().

Add src/tests/backend/specs/filterUpdatablePluginNames.ts covering: keep
prefixed names, drop ep_etherpad-lite, reject non-prefixed entries,
de-dupe repeats, tolerate missing/null/non-string name fields, empty
input, custom prefix.

Manually verified end-to-end on a live install: an
installed_plugins.json containing ep_markdown@11.0.5, a duplicate
ep_markdown, and a "malicious-package" entry runs `Updating plugins to
latest from registry: ep_markdown` (only) and ep_markdown ends up at
11.0.18 — the bad entries are silently filtered out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 07:22:25 +01:00
Sam Stauffacher
6cef831e70
plugins.ts - absence of case = "remove" (#7141) 2025-09-29 19:26:30 +02:00
Pascal Rigaux
90517c12c5
fix "pnpm run plugins install ep_xxx" (#7093)
With previous code, "pnpm run plugins i ep_xxx" is working correctly, but "pnpm run plugins install ep_xxx" does not work correctly (since var `registryPlugins` is empty)

Either "pnpm run plugins install ep_xxx" should be disallowed (by removing `case "install"`) or this fix should be applied.
2025-08-25 19:50:31 +02:00
JannikStreek
f8225b3e2a
fix github plugin installation (#6584) 2024-08-23 15:20:28 +02:00
Satoshi Yazawa
c16ce64ea0
Fix initialization for plugins (#6421)
Co-authored-by: yacchin1205 <968739+yacchin1205@users.noreply.github.com>
2024-06-02 12:58:18 +02:00
Satoshi Yazawa
3a1ef560ec
Upgrade live-plugin-manager to 1.0.0 (#6396)
* Upgrade the live-plugin-manager

* Fix migration scripts to skip checking for the system directory of live-plugin-manager

* Updated lockfile

* Improved handling of install.

---------

Co-authored-by: yacchin1205 <968739+yacchin1205@users.noreply.github.com>
Co-authored-by: SamTV12345 <40429738+samtv12345@users.noreply.github.com>
2024-06-01 14:05:53 +02:00
SamTV12345
f6f6ea9d4c Added compatibility with install-plugins script 2024-06-01 11:19:24 +02:00
SamTV12345
54860cd35a
Added querying and removing plugins. (#6274)
* Added querying and removing plugins.

* Added listing and removing plugins via cli
2024-05-18 11:56:41 +02:00