Repository navigation
Conversation
…allations Groundwork for updating dashmate itself. Neither module is wired into a command yet. Install-method detection distinguishes a Debian package, a tarball or macOS pkg, an npm install and an undetectable environment, and reports the absolute path to re-execute after an upgrade. It reads the signals oclif's own generators emit, never resolving the binary through PATH. The upgrade instructions it prints are our own text rather than the value of the environment variable oclif sets, since that variable is writable by anything that spawned us and the string is intended to be pasted into a root shell. Both variables are exported and so inherited by children, which is why a spawned process must be told the method rather than detecting it again. The installation scan enumerates every dashmate reachable on the host and distinguishes the one PATH resolves from the one currently executing. Upgrading a Debian package while an npm copy shadows it leaves the operator running unpatched code while apt and dashmate both report success. It executes nothing it discovers, reading versions from each installation's manifest instead, since running a binary found on PATH is the risk the scan exists to describe. Both degrade to a clearly marked result on Windows and neither throws; they will run on startup and diagnostic paths where a failure must not fail the command. Co-Authored-By: Claude Opus 5 <[email protected]>
…m a journal Groundwork for updating dashmate itself; not wired into a command yet. Whether a node has been brought up under the running dashmate version is observable, so it is probed rather than recorded. Two facts answer it: whether config.json on disk carries the format version this build expects, and whether the running helper container is on this version's image. The helper is the only image whose name changes across an upgrade, so a helper on the expected tag is evidence the config came up under this binary. The format version has to be read from disk, not from the loaded config: the repository migrates the whole document on every read, so the in-memory value is always the expected one and would report success even when nothing was persisted. The expected helper image is derived from the build flag rather than from the service list, which reports the released image name even when the helper is built locally. Comparing against that would leave every host with local builds permanently reported as not activated. Results are three-valued. A probe that cannot reach docker or read the config reports unknown, which never counts as activated, and a definite answer from one probe outranks unknown from the other. A config file newer than this build is its own state: re-running cannot resolve it, because migration stops when the file is already ahead. Co-Authored-By: Claude Opus 5 <[email protected]>
… understood Cross-model review found the combiner treated any probe result that was not literally pending or unknown as success, so a malformed or unrecognised result reported the node as activated — the inverse of the rule the design rests on. A result now counts only if it is positively recognised, and both probes must say activated for the node to be. The never-throws guarantee was also not absolute: null, primitive or malformed options escaped as a type error, as could reading the message off a thrown value that was not an error. Both boundaries now hold whatever they are given. A helper container with an unreadable image no longer hides a definite mismatch beside it. A known old image is conclusive, so it is decided before falling back to unknown. Whether the helper was built locally is now read from the image that is running rather than from the configuration flag, so the code matches what it claims to do. Deciding from intent was wrong in both directions: the flag can be set while the released image is still running, and cleared while a locally built one is. It also removes a config read that could throw. Tests are verified by mutation: replacing exact image comparison with a containment check, semver ordering with lexical, positive recognition with the old permissive rule, and reordering the unreadable-image check each fail. The test asserting the format probe needs no docker now asserts the dependency boundary directly, since a probe reaching for a docker singleton would pass every behavioural test. Co-Authored-By: Claude Opus 5 <[email protected]>
…tall Groundwork for updating dashmate itself; not wired into a command yet. The candidate comes from the channel that will perform the install: apt for a Debian package, the npm registry for an npm install. Asking anything else means the version an operator approves and the version that arrives are unrelated, and it would put an unauthenticated service in the decision path of the channel we sign. A version that is only offered, and a version it is correct to act on, are separate fields. Returning one value for both invites a caller to install a version this module refused, which matters because a registry tag re-cut backwards is how an operator gets walked onto an older release. Debian versions and application versions stay separate orderings over separate strings; nothing compares one with the other. Where the application versions are equal but the package versions differ, dpkg is asked which is greater rather than the answer being inferred, because that case is a rebuild of an installed version, which is how a fix ships without an upstream version change. A package on hold reports as such rather than as available, since the install would keep it back and report success. A version this module cannot map is reported unmapped rather than guessed at. Refreshing apt lists is skipped unless already root, so a check never demands a password; the refresh is scoped to our own source, keeps its cache in memory and cleans up nothing, so checking for an update cannot disturb the host's apt state. Every version crossing the boundary is validated before it is returned, printed or cached, so package-manager specifiers and terminal control sequences cannot reach a caller that builds an install argument from the result. Co-Authored-By: Claude Opus 5 <[email protected]>
The version pattern that decides what may reach a package manager, the characters stripped before remote text is printed, and the bounded body reader existed twice in the update candidate resolver and the status providers. Two copies of a validation rule are two copies that can drift, and the one that drifts might be the one deciding what gets installed. They now live in util/remoteInput.js. The bounded reader returns which limit it hit rather than a bare value, since one caller wants a log line and the other wants to tell an oversized response apart from a malformed one. The characters stripped from printed text are the set sanitizeRemoteText already defines, rather than a third copy of it. The resolver's own copy had drifted: it let the Arabic letter mark through, which the image-pull and status sanitizers both strip. The status providers keep their own copy for now. This branch is stacked on a base that predates their reviewed rewrite, and moving them here would conflict with it; they move once this branch carries that rewrite. Test would have caught this in CI: "should remove ARABIC LETTER MARK" fails before the fix and passes after; the other remoteInput specs pass on both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aced Groundwork for updating dashmate itself; not wired into a command yet. This is the first code here that runs a package manager as root, so it assumes every input is hostile and every success is unproven until read back. Failure is always a PackageUpgradeError carrying whether the package is unchanged, upgraded, replaced with something that was not approved, left unverified, or uncertain. Nothing else can escape: anything thrown from a seam is rethrown as one, unchanged if no package manager had run and uncertain otherwise. A caller deciding what to do next reads a field that is always present, because a failed root operation must not be ignorable by forgetting a branch. The exact Debian version is required and pinned in the command, so apt refuses a version nobody approved rather than installing whatever the pool sorts highest and being caught afterwards. Since prereleases and stable releases share one pool today, the alternative was approving a stable release and receiving a candidate. The version installed is read back and compared exactly. The environment reaching apt is rebuilt rather than filtered, because sudoers decides what survives sudo: a host configured to keep the caller's environment could otherwise pass through the variable that relocates apt's configuration and silently disables signature verification. The cost is that the sudoers rule an operator needs is not the obvious one, so a refusal is detected, distinguished from needing a password, and answered with the exact rule that works. Whether sudo will ask for a password is settled before any progress renderer starts, by asking sudo about the command that will actually run rather than about an unrelated one, so a password prompt can never appear behind a spinner. Running as root is detected on every install path and reported as a field, with a predicate exported for the command to refuse at startup: by the time this module could warn, a root-owned home directory has already been created. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
✅ Final review complete — no blockers (commit 740075a) |
Brings in v5.2-dev through the base pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nto shumkov/dm52-update-modules
Use the host apt policy, check the source of the selected version, and expose the privileged refresh ahead of candidate resolution. Remove installation scanning and activation probing from this layer. Regression checks failed before and passed after for candidate origin, four-digit apt priorities, Debian dev versions, unscoped install argv, refresh authorization probing, and root handling.
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Changes requested: 5 blockers
- APT can install another repository’s package under an approved Dash version —
packages/dashmate/src/update/resolveUpdateCandidate.js:435-443(new)
Impact: An operator with two configured APT sources offering the same Dashmate version can approve a Dash update but run another repository’s maintainer scripts as root. - npm can install the approved version from a different registry —
packages/dashmate/src/update/resolveUpdateCandidate.js:739-765(new)
Impact: Operators using an npm mirror can approve a version the installer cannot fetch, or receive a different build with the same version number. - npm can update a different installation from the one Dashmate detected —
packages/dashmate/src/update/upgradePackage.js:1324-1333(new)
Impact: Operators using a custom npm prefix, a project-local install, or a Yarn-managed copy can end up with a separate global installation while the Dashmate they launched stays unchanged. - APT reports the first beta as older than a dev build of the same release —
packages/dashmate/src/update/resolveUpdateCandidate.js:689-696(new)
Impact: Operators following the documented APT dev suite are not offered the beta of the release they are testing even when APT selects it as newer. - A verbose package upgrade can be interrupted and reported as unchanged —
packages/dashmate/src/update/upgradePackage.js:472-500(new)
Impact: Operators whose APT or npm transaction exceeds the output limit can be told the installation is unchanged even if the package manager had already started replacing files.
This PR adds Dashmate installation detection, update-candidate resolution, APT refresh, and version-pinned APT and npm installers without wiring them into the CLI or node restart flow. The checks for this head show passing policy and metadata checks and a pending review, but no Dashmate build, lint, or test result; the PR description reports passing local unit tests and lint with no errors. One verified suggestion was omitted to stay within the 10-comment limit.
🔴 5 blocking | 🟡 5 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — This is a substantial but contained dashmate package-management change involving privileged apt operations, remote registry input, version validation, subprocess handling, and installation verification, but it does not modify a critical protocol, funds, cryptographic, consensus, or storage surface. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/dashmate/src/update/resolveUpdateCandidate.js`:
- [BLOCKING] packages/dashmate/src/update/resolveUpdateCandidate.js:435-443: APT can install another repository’s package under an approved Dash version
Impact: An operator with two configured APT sources offering the same Dashmate version can approve a Dash update but run another repository’s maintainer scripts as root.
The upgrade can report success without installing the package that passed the Dash-source check. `candidateHasDashSource` accepts any Dash source row for the candidate, but the privileged installer passes only `dashmate=<version>` to APT with the full host configuration. As `apt_preferences(5)` documents, pin priorities choose the version, not which source supplies an instance of that version; source order can select another copy. The dpkg readback checks only the version, after maintainer scripts can run. Keep host policy for choosing the candidate, but bind installation to the artifact authenticated by Dash’s repository or refuse the update when that provenance cannot be established.
- [BLOCKING] packages/dashmate/src/update/resolveUpdateCandidate.js:739-765: npm can install the approved version from a different registry
Impact: Operators using an npm mirror can approve a version the installer cannot fetch, or receive a different build with the same version number.
The registry that supplies the approved version does not constrain the install. The resolver honors `npm_config_registry`, but `buildNpmEnv` drops it and `npm install -g` passes no registry option. The reverse mismatch happens when the mirror is configured in `~/.npmrc`: resolution defaults to public npm, while installation preserves `HOME` and npm reads that file. Reading the manifest version back cannot distinguish the two registries’ packages, and npm can run lifecycle scripts before the readback. Use the same validated registry configuration for both operations, carry the approved artifact’s integrity through to installation, and decline automatic replacement when that binding cannot be made.
- [BLOCKING] packages/dashmate/src/update/resolveUpdateCandidate.js:689-696: APT reports the first beta as older than a dev build of the same release
Impact: Operators following the documented APT dev suite are not offered the beta of the release they are testing even when APT selects it as newer.
The resolver returns `CANDIDATE_OLDER` with no installable version for a normal dev-to-beta upgrade. `scripts/deb-version.mjs` deliberately gives dev builds two tildes so dpkg orders `5.1.0~~dev.11-1` before `5.1.0~beta.1-1`. The resolver calls dpkg only when the mapped application versions are equal, so this pair goes through SemVer, where `beta` sorts before `dev`. Compare the installed and candidate Debian versions with dpkg, as the manual update guide does, and use the mapped application version for display and prerelease consent.
- [SUGGESTION] packages/dashmate/src/update/resolveUpdateCandidate.js:752-759: Rejected npm registry URLs retain passwords in candidate diagnostics
Impact: Operators who put credentials in an unsupported registry URL can disclose them if a caller logs or shares the candidate details.
Rejecting the URL prevents the fetch but leaves the secret in the result. The rejection paths put the original URL through `sanitizeForLog`, which strips control characters and truncates text but does not redact credentials, and the resolver exposes it as `details.registryUrlIgnored`. The registry-selection test explicitly expects the credential-bearing value to survive. Return a fixed rejection reason instead of the input, including when URL parsing fails.
- [SUGGESTION] packages/dashmate/src/update/resolveUpdateCandidate.js:928-932: The Debian installable field omits the version APT actually needs
Impact: A caller following the resolver’s contract cannot pin a Debian update from the documented field alone, and a same-release mix-up can install a prerelease while reporting the stable version.
The handoff can produce either a failed install or a misleading success result. `installableVersion` is documented as the only field suitable for package-manager arguments, but for APT it contains the application version, such as `4.2.0-rc.1`, not the Debian package version `4.2.0~rc.1-1`. The exact value is in `packageVersion`, which is also populated for some non-actionable results. The installer requires callers to assemble the pair, checks only `major.minor.patch`, and echoes the requested application version on success. Return a single channel-specific install target only for actionable candidates, and use the same full Debian-to-application mapping at the install boundary to validate the pair.
In `packages/dashmate/src/update/upgradePackage.js`:
- [BLOCKING] packages/dashmate/src/update/upgradePackage.js:1324-1333: npm can update a different installation from the one Dashmate detected
Impact: Operators using a custom npm prefix, a project-local install, or a Yarn-managed copy can end up with a separate global installation while the Dashmate they launched stays unchanged.
The installer can write to the wrong location before verification notices. Detection derives the prefix from the running package root, but the installer uses it only to locate npm and read back the manifest. Finding npm does not set its effective prefix: for example, `buildNpmEnv` drops an `NPM_CONFIG_PREFIX` override, and the install argv does not pass the detected prefix. Detection also labels a Yarn or project-local layout as npm even when it cannot derive any global prefix, and the installer still tries npm beside Node. Require a confirmed npm global destination before offering automatic replacement, and use that same prefix for installation, verification, and recovery instructions.
- [BLOCKING] packages/dashmate/src/update/upgradePackage.js:472-500: A verbose package upgrade can be interrupted and reported as unchanged
Impact: Operators whose APT or npm transaction exceeds the output limit can be told the installation is unchanged even if the package manager had already started replacing files.
An output limit intended for diagnostics can interrupt a live package transaction and suppress the checks that would tell the operator whether recovery is needed. Node’s `execFile` terminates the child when either stream crosses the 8 MiB `maxBuffer` limit. It returns `ERR_CHILD_PROCESS_STDIO_MAXBUFFER` without the `killed` or `signal` fields this catch checks, so the error lands in `spawnError`. Both install branches then return `UNCHANGED` without checking the package. Drain live install output while retaining only a bounded diagnostic tail, and reserve `UNCHANGED` without a health check for confirmed failures to start.
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:796-817: Interactive APT refresh can fail without prompting under mixed sudo rules
Impact: A non-root operator who may run APT with a password can get a failed refresh without a prompt even after opting into interactive authentication.
A successful permission listing can skip the only password prompt. Under sudoers’ default `listpw=any`, an unrelated `NOPASSWD` rule can let `sudo -n -l` list a command that still needs authentication to run. `ensureRootAccess` returns `authenticated: true` on listing success, so it skips `sudo -v`; `refreshAptLists` then runs with `-n` and reports the password refusal as an unknown result. Separate permission listing from authentication, and handle a password requirement at the explicit interactive boundary without retrying an operation that may already have started.
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:946-950: A working nvm installation can fail Dashmate’s health check
Impact: Operators using the documented nvm setup can be told their installation is in an uncertain state after a failed npm download that left Dashmate working.
The health probe can fail because it uses a different Node environment than the install. The npm launcher uses `#!/usr/bin/env node`, but `verifyDashmateRuns` passes a system-only `PATH` that omits nvm. It can fail to find Node or use a different system version; the same problem affects the version fallback when the npm manifest cannot be read. Use the allowlisted npm runtime path or the known Node executable for npm verification, while keeping the Debian probe environment separate.
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:277-302: Package-manager diagnostics can display text in a misleading order
Impact: Operators reading an APT or npm error can see reordered text when subprocess output contains bidirectional controls.
The installer’s filter lets through Unicode overrides and isolates that can reorder error text on renderers that support bidirectional text. It strips ANSI and C0/C1 controls, but not the directional characters already covered by `UNPRINTABLE` and used by `remoteInput`. Apply the same character policy while preserving the tabs, newlines, and bounded tail needed for command diagnostics. The status provider also retains separate copies of the character filter, version parser, and capped body reader; using the shared helpers there would prevent those copies from drifting.
…ation Reject ambiguous apt sources and order Debian candidates with dpkg. Pin npm registry and prefix, verify the full Debian version mapping, and drain package manager output while preserving recovery checks. Regression tests failed before and passed after for package selection, install arguments, transaction output, sudo preflight, npm health checks, and diagnostic filtering.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 2 blockers
- APT can install another repository’s package under an approved Dash version —
packages/dashmate/src/update/upgradePackage.js:600-615(carried)
Impact: An operator can approve a Dash update and install a same-version copy from another configured repository as root if APT’s indexes change before installation. - npm can install the approved version from a different registry —
packages/dashmate/src/update/resolveUpdateCandidate.js:791-827(thread, carried)
Impact: An operator using an npm mirror can approve an update and receive different package contents under the same version when the mirror’s tag and package metadata disagree.
New on this head: This revision tightens Dashmate’s package-update handoff by pinning npm’s destination and registry URL, using dpkg to order Debian candidates, and draining package-manager output without interrupting the transaction. Policy and title checks passed, the review check was pending, and no Dashmate build, lint, or test check was listed for this head.
🔴 2 blocking | 🟡 3 suggestion(s)
Still open from earlier rounds (1)
- 🔴 Blocking: npm can install the approved version from a different registry —
packages/dashmate/src/update/resolveUpdateCandidate.js:791-827(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — This is a substantial but self-contained package-update feature involving apt/npm resolution, privileged subprocesses, remote input handling, and verification, but it does not change a critical surface listed for the critical tier. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - New since the last final review (
8e2b6525): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 not confirmed (no longer blocking) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/dashmate/src/update/upgradePackage.js`:
- [BLOCKING] packages/dashmate/src/update/upgradePackage.js:600-615: APT can install another repository’s package under an approved Dash version
Impact: An operator can approve a Dash update and install a same-version copy from another configured repository as root if APT’s indexes change before installation.
Dashmate can report a successful update without installing the package whose source it checked. The new exclusivity check rejects competing sources visible in the final `apt-cache policy` snapshot. After that check, the updater audits dpkg and reads the installed version, then invokes `apt-get install` with only `dashmate=<version>`. If a concurrent refresh exposes a same-version copy from a preferred configured source in that interval, APT can select it and run its maintainer scripts as root. The dpkg readback checks the version, not the source. Keep host policy for candidate selection, but bind the privileged install to the archive authenticated by Dash’s repository or decline the automatic upgrade.
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:1346-1364: npm errors can trigger a root retry recommendation for user-managed installs
Impact: An operator who copies the suggested retry after an npm error can write root-owned files into their version-manager prefix or run a user-selected mirror’s install with elevated privileges.
The recovery command recommends `sudo npm` even when the prefix is writable or belongs to a version manager. The branch treats permission-related words anywhere in npm’s output as proof that another user owns the prefix, but npm’s diagnostics can include registry error text. The newly added `--prefix` and `--registry` flags carry the exact user-managed destination and user-selected source into the privileged retry, even though the message warns nvm, Volta, and asdf users not to use sudo. Report the failure without inferring ownership from subprocess text. Give ownership-recovery guidance for user-managed or unverified prefixes and leave any privileged retry to the administrator.
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:827-840: Interactive APT updates can prompt for a password even when APT is passwordless
Impact: An operator whose account has passwordless APT access but a password requirement on an unrelated sudo rule can see a password prompt that the update itself does not need.
An interactive update now asks for a password on some hosts where the APT commands already run without one. The new preflight calls `sudo -v` even after the command listing succeeds. Under sudoers’ default `verifypw=all`, an unrelated password-required rule is enough to make `sudo -v` prompt even if the APT rules are `NOPASSWD`. Keep the fix for password-required APT rules, but tie the prompt to a confirmed authentication refusal for the requested command, without retrying a package transaction that may have started.
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:1535-1546: Automatic npm updates bypass mirrors configured in npmrc
Impact: An operator with a writable global Dashmate install and a mirror configured only in npmrc can approve a same-major update and have their mirror-managed copy replaced with a public npm build.
The updater can replace a mirror-managed installation from public npm without the operator changing registries. `resolveRegistryUrl` checks an explicit value and environment variables, but falls back to public npm when the registry is set only in user or global npmrc. #6484 forwards that fallback on the normal update path. The new `--registry` argument overrides npmrc, so approving a newer public version causes npm to write it into the detected prefix; the version readback has no source check. Previously the lookup missed the mirror, but the install still let npm honor its configuration. Ask the npm executable that will perform the install for its effective registry in the same global prefix, and decline automatic replacement if that configuration cannot be honored.
_Raised as blocking. An independent pass did not find a failure someone would actually hit, so it does not block: The registry mismatch is real: resolveRegistryUrl ignores npmrc, and upgradePackage turns the public fallback into an explicit --registry flag that overrides npmrc. But at the reviewed head, dashmate update pulls Docker images and checks certificates; no shipped command or public API calls the package-upgrade helpers. The caller that forwards the fallback is in #6484, so this should be fixed before that PR enables automatic package replacement._
In `packages/dashmate/src/update/resolveUpdateCandidate.js`:
- [BLOCKING] packages/dashmate/src/update/resolveUpdateCandidate.js:791-827: npm can install the approved version from a different registry
(carried; thread: https://github.com/dashpay/platform/pull/5819#discussion_r4782705395)
…o -v for NOPASSWD - Resolve npm's effective global registry from the detected npm binary when neither options.registryUrl nor npm_config_registry is set, using the same sanitized npm environment as upgradePackage; decline automatic replacement if unreadable or invalid instead of falling back to public npm. - Stop inferring prefix ownership from npm output and drop sudo npm from manual recovery instructions in favor of the unprivileged command and ownership guidance. - Probe sudo with -n -l -l and skip interactive sudo -v when every probed APT rule explicitly confirms !authenticate. Tests would have caught all three issues in CI: ✖ before fix, ✔ after.
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Updated after discussion: 1 finding(s) of this review were settled in the inline threads.
- ⏭️ Deferred (maintainer decision): 🟡 Update checks cannot see releases on npm mirrors that require authentication (tracked in #6489)
New on this head: This revision makes Dashmate’s package-update helpers query npm for its configured registry, removes the privileged npm retry hint, and adds a passwordless-sudo shortcut for APT preflight. Package replacement is not yet wired into the CLI. The review check is pending, the reported policy and title checks passed, and no Dashmate build, lint, or test result was reported for this head.
🟡 4 3 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Still open from earlier rounds (2)
- 🟡 Suggestion: APT can install another repository’s package under an approved Dash version —
packages/dashmate/src/update/upgradePackage.js:566-582(thread) - 🟡 Suggestion: Interactive APT updates can prompt for a password even when APT is passwordless —
packages/dashmate/src/update/upgradePackage.js:824-842(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — This is a large but contained package-update feature that changes privileged apt/npm execution and remote-input handling, without affecting consensus, funds, cryptography, keys, peer deserialization, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/dashmate/src/update/resolveUpdateCandidate.js`:
- [SUGGESTION] packages/dashmate/src/update/resolveUpdateCandidate.js:754-789: Automatic npm updates bypass mirrors configured in npmrc
Impact: Once package replacement is enabled, an operator whose registry is configured in a redirected or unreadable npmrc can be offered a public npm build in place of their mirror-managed install.
The new probe can accept public npm even though it never read the file that selects the mirror. `buildNpmEnv` omits `NPM_CONFIG_USERCONFIG` and `NPM_CONFIG_GLOBALCONFIG`, so npm uses its default file locations instead. Even at those locations, npm 11 logs read errors without failing `config get registry`; the command can print the public default and exit successfully. Dashmate validates that URL and the pending caller in #6484 forwards it as an explicit `--registry`. Honor supported config-file selectors consistently in lookup and install, and decline automatic replacement if the selected configuration cannot be read, without printing raw config or credentials.
- [SUGGESTION → DEFERRED by a maintainer; not blocking, do not fix in this PR] packages/dashmate/src/update/resolveUpdateCandidate.js:836-866: Update checks cannot see releases on npm mirrors that require authentication
Impact: An operator whose npmrc points to a token-protected mirror gets an unknown candidate even though npm can see and install the release.
The new npmrc lookup discovers the mirror URL but then queries it anonymously. `defaultFetchJson` sends only an `Accept` header, so a mirror that requires credentials for metadata returns an error or a 404 that Dashmate reports as package missing. Use the detected npm executable to query metadata with the same global prefix and registry as installation so npm applies its own credentials. Retain the timeout, output cap, and version validation.
In `packages/dashmate/src/update/upgradePackage.js`:
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:566-582: APT can install another repository’s package under an approved Dash version
(carried; thread: https://github.com/dashpay/platform/pull/5819#discussion_r4784347379)
- [SUGGESTION] packages/dashmate/src/update/upgradePackage.js:824-842: Interactive APT updates can prompt for a password even when APT is passwordless
(carried; thread: https://github.com/dashpay/platform/pull/5819#discussion_r4784347394)
Basic explanation
This adds the package-update modules that a future
dashmate updatecommand can use to check for and install newer Dashmate packages through apt or npm. The CLI wiring and node restart are follow-up work.Issue being fixed or feature implemented
Updating the Dashmate package currently requires a separate manual procedure for each installation channel. These modules let the command use the existing package managers. This PR is based on #4283.
What was done?
detectInstallMethodidentifies deb, npm, and unsupported installations.resolveUpdateCandidateuses the host's apt policy, requires the exact Debian candidate to list Dash's repository, and maps stable and prerelease packages to their application versions. For npm it queries the registry.upgradePackageprovides a privileged apt refresh for use before the final candidate lookup. Refresh failure leaves the candidate unknown and reports manual commands. Apt and npm installs pin the selected version and verify the version installed afterward.remoteInputshares version validation, response size limits, and output sanitization.How Has This Been Tested?
yarn workspace dashmate test:unit— 2,209 unit tests passed on macOS with Node.js 24.yarn workspace dashmate lint— 0 errors and 45 existing warnings.Breaking Changes
None.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only