remove --preserve-state on a manifest-less hosted npm project silently restores the pin without the documented hosted_state_not_preservable note
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
Rechercherichtung
Beginne in crates/socket-patch-cli/src/commands/remove.rs bei remove_hosted_only (etwa bei Zeile 1337), und vergleiche es anschließend mit dem manifestbasierten Hosted-Pfad bei etwa Zeile 770. Reproduziere remove --preserve-state im Nur-Hosted-Modus mit und ohne --json, und vergleiche die Ausgabe mit CLI_CONTRACT.md und rollback --preserve-state. Als erledigt gilt die Aufgabe, wenn der Hinweis hosted_state_not_preservable in beiden unterstützten Ausgabemodi angezeigt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
[agent] Found by the scheduled npm bug-hunt routine (ledger #302).
Summary
In v5, a project patched by a bare scan (hosted mode) has no .socket/manifest.json. On such a project, socket-patch remove <purl> --preserve-state restores the hosted pin to the upstream registry and deletes the .npmrc. So the patch is gone, even though the user asked to preserve state.
The command never tells the user this. There's no "hosted wiring has no preservable local state" note on stderr, and no warnings[] in --json (the envelope has no warnings key at all). rollback --preserve-state on the same project correctly emits hosted_state_not_preservable.
Severity is low. The behaviour (restoring anyway) is what's documented; only the advisory is missing. But --preserve-state exists so the user can expect to re-apply later, and here it silently doesn't preserve.
Repro (Linux, npm 12.1.0, main 2463257)
A local mock of the patch API serves pkg:npm/[email protected]. SPA="--api-url … --org o --api-token fake --patch-server-url …".
echo '{"name":"t","version":"1.0.0","private":true,"dependencies":{"left-pad":"1.3.0"}}' > package.json
npm install
socket-patch scan $SPA # hosted: package-lock.json + .npmrc rewritten, no .socket/
socket-patch remove pkg:npm/[email protected] --preserve-state $SPA
# The following hosted patch will be unwound and removed:
# - pkg:npm/[email protected]
# Restored pkg:npm/[email protected] to its upstream registry entry
# (no "no preservable local state" note)
socket-patch scan $SPA
socket-patch remove pkg:npm/[email protected] --preserve-state $SPA --json # status success, events[hosted_reverted], no warnings key
socket-patch scan $SPA
socket-patch rollback --preserve-state $SPA --json # warnings: [reinstall_required, hosted_state_not_preservable] <- correct
It reproduces on 2 of 2 runs.
Expected vs actual
- Expected: CLI_CONTRACT.md's warning table, row
hosted_state_not_preservable, says: "rollback--preserve-state(v5.0): hosted pins were restored to upstream anyway … (remove --preserve-stateprints the same note on stderr.)". The--preserve-state (opt-out, both rollback and remove)section says the same: "a preserve run still restores them to upstream — surfaced as thehosted_state_not_preservablewarning". - Actual: the note is printed only on the manifest-backed
removepath. The hosted-only path, which is the default v5 shape, prints nothing.
| Project shape | remove --preserve-state note |
|---|---|
| Hosted-only (no manifest), Linux npm 12.1.0 | missing (stderr and JSON) |
rollback --preserve-state, same project |
present |
Suspect code
crates/socket-patch-cli/src/commands/remove.rs:1337 (remove_hosted_only). Its doc comment says "--preserve-state still unwinds — hosted has no preservable local state". But the Note: hosted wiring has no preservable local state … eprintln only exists in the manifest-backed hosted leg (remove.rs:770).
- Vorherrschende Sprache
- Rust
- Sterne
- 8
- Forks
- 0
- Ø Merge
- 15 Std. 39 Min.
- Gemergte PRs (30 T.)
- 104
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus SocketDev/socket-patch
-
agent:triaged bug bughunt pm:pipenv priority:p1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
SocketDev/socket-patch#744 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged bug bughunt pm:cargo priority:p2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
SocketDev/socket-patch#651 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Vendored Hatch runs a `hatch` executable planted in the scanned projectEvtl. vergeben @mikolalysenko hat das vor 1 Tag übernommen. Offenagent:claimed agent:triaged arch-audit bug pm:hatch priority:p1
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 88/100
SocketDev/socket-patch#613 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Patch blob and diff downloads buffer the whole response body with no size capEvtl. vergeben @mikolalysenko hat das vor 1 Tag übernommen. Offenagent:claimed agent:triaged arch-audit bug priority:p3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
SocketDev/socket-patch#571 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged bug bughunt pm:composer priority:p2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
SocketDev/socket-patch#515 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in SocketDev/socket-patch
Ähnliche Issues
-
MessageField::clone copies the whole payload, even for an unset field: clone 1.4× slower than prost on small messagesEvtl. vergeben @benedikt-bartscher hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
anthropics/buffa#549 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag
-
contribution
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
tree-sitter/tree-sitter#6005 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100