mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: harden system-install review findings
Require root-owned, non-group/other-writable pmg for --system install; allow remove without that validation. Doctor checks npm resolution for PATH precedence, uses ImpliesInterception instead of message matching, and documents version-manager shadowing. Pass profile bin dir from the shim manager and note that system config ignores per-user files. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-4
@@ -105,7 +105,7 @@ func install(system bool) error {
|
||||
}
|
||||
|
||||
func installSystem() error {
|
||||
if err := errIfSystemInstallAllowed(); err != nil {
|
||||
if err := requireSystemInstallSupported(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -190,11 +190,11 @@ func remove(system, removeConfig bool) error {
|
||||
}
|
||||
|
||||
func removeSystem(removeConfig bool) error {
|
||||
if err := errIfSystemInstallAllowed(); err != nil {
|
||||
if err := requireSystemInstallSupported(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
shimMgr, err := shim.NewSystemShimManager()
|
||||
shimMgr, err := shim.NewSystemShimManagerForRemove()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create system shim manager: %w", err)
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func removeSystem(removeConfig bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func errIfSystemInstallAllowed() error {
|
||||
func requireSystemInstallSupported() error {
|
||||
if runtime.GOOS != "linux" {
|
||||
return usefulerror.NewUsefulError().
|
||||
WithCode(errcodes.UnsupportedPlatform).
|
||||
|
||||
Reference in New Issue
Block a user