Skip to content

About

DSH plugin: a settings switch that stops DSH Desktop from checking for its own updates, by mirroring one boolean onto the app's own user config (no installed file is modified).

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

dsh-desktop-update-guard

A DeepSeek Harness (DSH) plugin that adds a single switch to the DSH settings UI:

should DSH Desktop check for its own updates?

Switch it off and the desktop app stops checking, stops prompting and never auto-updates — until you switch it back on. Switch it on and you get the app's normal behaviour back.

It does this without touching a single installed file. No app.asar, no .exe, no registry: it only writes one field in the desktop app's own user settings file, plus its own switch value in a DSH settings namespace.


⚠️ Security impact — read this before using it

This plugin works by writing a far-future timestamp into the desktop app's private configuration and re-asserting it periodically. That has consequences you should accept knowingly. This section is deliberately blunt.

  1. You will stop receiving update notifications, including security fixes. Auto-update checks are exactly the channel that tells you a new version exists. While the switch is off, a security release can ship and nothing will tell you.
  2. Manual checking still really checks. The pin only defeats the automatic age-based check. If you use the app's own "check for updates" action, it will still contact the vendor's release feed, really query it, and write a fresh timestamp back. The plugin will then re-pin over it within reassertMs (60 s by default). So the pin is not a network block, and it is not a privacy feature.
  3. This is an unsupported modification of another program's private state. The field this plugin writes is not a documented, supported interface. The app's authors never agreed to it, and it may conflict with the app's own writes to that file.
  4. If upstream renames its directory or changes its check logic, this plugin silently stops working. The detection would then report detected: false and the card would say "not detected" rather than showing a green lock — but if the logic changes without the directory changing, the card can show "locked" while the app updates anyway. When in doubt, trust the app's own manual check, not this card.
  5. Un-pin before you uninstall. Removing the plugin does not remove the pin. If you uninstalled while the switch was off, the desktop app is still pinned. Use tools/rollback-dry-run.ps1 (dry-run by default) or switch the plugin back on once before removing it.
  6. The switch is not a security boundary. It is a convenience setting for machines where you have decided to hold a version — a kiosk, a lab machine, an offline workstation. It is not appropriate for a machine whose updates you need to track.

What it does not do — positive guarantees

  • Does not read credentials. It never opens ~/.dsh/.credentials.yaml, environment secrets, API keys or tokens. Its only file access is the desktop app's settings.json and the read-only listing of the app's own updates/ directory.
  • Does not touch the registry. No reg, no HKCU/HKLM, no installer actions.
  • Does not modify installed files. No writes to app.asar, the executable, or the application directory.
  • Does not read or rewrite the file if it cannot parse it. A settings file that is missing, unreadable, or not valid JSON is left completely untouched — the plugin refuses to write rather than risk replacing your configuration with defaults. It also never creates that file.
  • Only ever changes one field (updateLastCheckedAt), preserving every other key, and never deletes a timestamp the app wrote itself.
  • Never breaks DSH boot. Everything is wrapped in try/catch; a failure is reported in the card and the log, and swallowed otherwise.
  • No telemetry. The only outbound request is the optional "latest version" lookup, which is a single GET to the configured release feed and only when the card asks for it.

Unofficial

This is an unofficial, third-party plugin. It is not affiliated with, endorsed by, or supported by the authors of DSH, DSH Desktop, Electron, or GitHub. "DSH Desktop" is referred to only to describe what the plugin operates on.


Requirements

OS Windows only (os: ["win32"]) — the file layout and the optional version probe are Windows-specific
Node.js ^22.19.0 || >=24.0.0 (the host DSH runtime provides this)
DSH verified against DSH 0.1.5-rc.2
DSH Desktop verified against DSH Desktop 0.5.12 (see "Verified against" below)

Verified against. Those are the versions this plugin was actually exercised on. It relies on host internals that are not a public API (settings, webServer, the settings.plugin.item slot, window.__ModuleLoader__), so a DSH upgrade can rename or drop them. The plugin declares them as peerDependencies so the coupling is at least visible.


Install

dsh plugin forwards its arguments to pnpm inside the profile directory, so anything pnpm accepts works:

# from a git repository
dsh plugin --profile <profile> add github:an94-code/dsh-desktop-update-guard

# from a local checkout or a packed tarball
dsh plugin --profile <profile> add ./path/to/dsh-desktop-update-guard
dsh plugin --profile <profile> add ./dsh-desktop-update-guard-0.1.1.tgz

Then restart DSH — plugins are loaded at boot.

One extra step for the settings card

The server half is mounted by this package's bundle patch. The settings card additionally has to be listed in your profile's client bundle list, or the UI will not appear:

// <profile>/package.json
{
  "dsh": {
    "profile": {
      "bundles": ["dsh-desktop-update-guard"]
    }
  }
}

Restart again after adding it. Without this the switch still works through the HTTP routes below; only the card is missing.


Configuration

Configuration lives in the bundle patch (cordis.patch.yml) under the plugin's config: block, or in your profile's own override layer.

Option Type Default Meaning
allowUpdate boolean true The switch itself. true = leave the app alone; false = pin the auto-check off. The card writes this through the settings service.
desktopHome string '' (auto) Directory holding the desktop app's settings.json. Empty means auto-detect (see below). If detection fails, the card says "not detected" and the plugin writes nothing — it never guesses a directory into existence.
reassertMs number 60000 How often the pin is re-checked and re-applied.
pinMs number 4102444800000 The far-future timestamp written while locked (2100-01-01 UTC, in ms).
feed string DSH Desktop release feed Release feed for the "latest version" line. Set to '' to disable that lookup entirely.
versionProbe boolean false When true, spawns a shell once per cache window to read the app executable's version. Off by default because it spawns a process.
powerShellPath string '' (auto) Shell used by versionProbe. Empty = look for powershell.exe under %SystemRoot%.
backupSuffix string '.mo.bak' Suffix of the best-effort backup copy written next to settings.json before each change.
settingsFileName string 'settings.json' Name of the settings file inside desktopHome.

How desktopHome is detected

When desktopHome is empty, these candidates are probed in order and the first one that actually contains a settings.json wins:

  1. $DSH_DESKTOP_HOME
  2. %APPDATA%\bruc3van-dsh-desktop
  3. ~\bruc3van-dsh-desktop
  4. %APPDATA%\dsh-desktop, ~\.dsh-desktop (generic fallbacks)

bruc3van-dsh-desktop is the upstream DSH Desktop application's own userData directory name. It is not related to this plugin's author. The generic names are kept only as fallbacks in case upstream renames its directory. If nothing matches, the plugin reports detected: false and the card says "not detected" — it does not show a green lock.

If detection fails on your machine, set the directory explicitly:

- id: desktop-update-guard
  config:
    desktopHome: 'C:\Users\you\AppData\Roaming\bruc3van-dsh-desktop'

How it works

Source of truth The DSH settings namespace desktop-update (stored in ~/.dsh/settings.yaml, so it survives app and DSH upgrades)
UI Settings → Plugins → Plugin configuration → "DSH Desktop 自动更新" card (one switch + version info)
Effect updateLastCheckedAt inside <desktopHome>/settings.json
  • On — the field is removed, restoring the app's own behaviour.
  • Off — the field is written as 4102444800000 (2100-01-01 UTC). The app's automatic check is an age comparison against that value, so "time to check again" is never true.
  • Guard — re-checked every reassertMs and on every switch change. A timestamp overwritten by the app's manual check, or a settings value changed by hand, gets corrected.

Write safety

  • Atomic: temp file + rename, with a best-effort .mo.bak copy first.
  • Re-read guard: the file is re-read immediately before each replacement and the change is applied to the freshest version, which shrinks the window in which the app's own concurrent write could be clobbered. If the file changes under us, the write is skipped and reported.
  • Verified by re-reading the file afterwards.
  • Only our own pin is ever deleted. A timestamp that is not further in the future than "now + one year" is treated as the app's and left alone.

HTTP interface

The card talks to its own same-origin routes on the local DSH web server:

GET  /dsh-desktop-update/status[?force=1]   read the switch + versions
POST /dsh-desktop-update/set                {"allowUpdate": false}

Request defences

/status requires a loopback Host and nothing else (it is a read).

/set must be a POST, the body must parse as JSON and allowUpdate must be a real boolean, and on top of that:

  1. Host must be loopback (127.0.0.1, localhost, [::1]).
  2. If an Origin header is present it must be a loopback origin.
  3. Otherwise, if a Referer is present, it must be a loopback referer.
  4. Otherwise — with neither header — the Content-Type must be application/json.

Rule 4 is the important one: a browser cannot send Content-Type: application/json on a cross-origin "simple" request without a preflight, so a random web page cannot silently flip the switch with a plain form post. The settings card fetches same-origin, so it always satisfies these rules and the card behaves exactly as before.

/status does not return process.execPath or any raw absolute path — paths are abbreviated with ~ for the current user's home directory before they leave the server.


Uninstall / rollback

dsh plugin --profile <profile> remove dsh-desktop-update-guard

Un-pin first. Removing the plugin leaves the pin in place. Either switch it back on before removing, or run the rollback tool afterwards.

# dry run (default): shows what would be removed, changes nothing
powershell -ExecutionPolicy Bypass -File .\tools\rollback-dry-run.ps1

# actually remove the pin (backs the file up first)
powershell -ExecutionPolicy Bypass -File .\tools\rollback-dry-run.ps1 -Apply

# or point it at an explicit directory
powershell -ExecutionPolicy Bypass -File .\tools\rollback-dry-run.ps1 -DesktopHome <dir> -Apply

rollback-dry-run.ps1 only removes a value it recognises as this plugin's pin, never rewrites an unparsable file, and writes settings.json.bak-before-rollback before changing anything.


Development

npm test          # node --test — fully offline
node --check lib/index.js
node --check lib/client.js

The offline suite needs no DSH installation and no network. Because the plugin imports the host-provided @deepseek-ai/schemastery at module scope, the test command registers a tiny resolve shim (tools/register-test-stubs.mjs) that redirects that one specifier to tools/stub-schemastery.mjs. Every other import resolves normally.

The server tests run against throw-away directories created with mkdtempSync, behind hard guardrails: the fixture directory must be under the OS temp root and must not be the real user home, and the real desktop settings file is fingerprinted (mtime + size + SHA-256) before and after the suite and asserted unchanged. Nothing in the suite can touch a live configuration.

tools/verify.mjs is the one tool that talks to a live installation; it is a dry run unless you pass an explicit --file, and it refuses to write to an auto-detected path:

node tools/verify.mjs                                  # read-only probe
node tools/verify.mjs --file ./tmp/settings.json       # exercise the write path on a copy

License

MIT © an94-code

About

DSH plugin: a settings switch that stops DSH Desktop from checking for its own updates, by mirroring one boolean onto the app's own user config (no installed file is modified).

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages