Skip to content

fix: remove chownr and mkdirp-infer-owner - #5710

Merged
lukekarrys merged 2 commits into
latestfrom
nlf/cli-no-ownership-changes
Oct 18, 2022
Merged

fix: remove chownr and mkdirp-infer-owner#5710
lukekarrys merged 2 commits into
latestfrom
nlf/cli-no-ownership-changes

Conversation

@nlf

@nlf nlf commented Oct 18, 2022

Copy link
Copy Markdown
Contributor

closes npm/statusboard#540

BREAKING CHANGE: npm will no longer attempt to modify ownership of files it creates

this builds on #5707, land that first

lukekarrys and others added 2 commits October 18, 2022 13:07
- @npmcli/config@6.0.1
- @npmcli/disparity-colors@3.0.0
- @npmcli/git@4.0.1
- @npmcli/installed-package-contents@2.0.0
- @npmcli/map-workspaces@3.0.0
- @npmcli/metavuln-calculator@5.0.0
- @npmcli/move-file@3.0.0
- @npmcli/node-gyp@3.0.0
- @npmcli/package-json@3.0.0
- @npmcli/promise-spawn@4.0.0
- @npmcli/query@3.0.0
- @npmcli/run-script@5.0.0
- bin-links@4.0.1
- cacache@17.0.1
- ignore-walk@6.0.0
- init-package-json@4.0.1
- json-parse-even-better-errors@3.0.0
- make-fetch-happen@11.0.1
- normalize-package-data@5.0.0
- npm-audit-report@4.0.0
- npm-install-checks@6.0.0
- npm-packlist@7.0.1
- npm-pick-manifest@8.0.1
- npm-profile@7.0.1
- npm-registry-fetch@14.0.2
- npmlog@7.0.0
- pacote@15.0.1
- parse-conflict-json@3.0.0
- proc-log@3.0.0
- read-package-json-fast@3.0.1
- read-package-json@6.0.0
- ssri@10.0.0
- treeverse@3.0.0
- validate-npm-package-name@5.0.0
- write-file-atomic@5.0.0

Removed dependencies:
- `@npmcli/fs`
closes npm/statusboard#540

BREAKING CHANGE: npm will no longer attempt to modify ownership of files it creates
@nlf
nlf requested a review from a team as a code owner October 18, 2022 20:42
@lukekarrys
lukekarrys merged commit 353b5bb into latest Oct 18, 2022
@lukekarrys
lukekarrys deleted the nlf/cli-no-ownership-changes branch October 18, 2022 21:15
zkochan added a commit to pnpm/pnpm that referenced this pull request Aug 5, 2026
…13495)

pnpm keeps global packages and configuration in the invoking user's
home directory, so 'sudo pnpm add -g', 'sudo pnpm setup', and
'sudo pnpm self-update' never do what the user wants: they target
root's home and leave root-owned files behind. Other package managers
settled on the same direction - npm 9 removed its SUDO_UID chown
machinery (npm/cli#5710) and tells users not to use sudo, and Homebrew
refuses root outright.

Both stacks detect the same situation: effective uid 0, SUDO_USER
naming a non-root user, and a command that mutates home-directory
state - setup, self-update, or a global write (add, remove, update,
runtime, approve-builds, bare link, config set/delete resolving to
the global scope). They differ only in severity, because refusing
these commands is a breaking change: pnpm v11 warns and names the
v12 removal, so existing provisioning scripts keep working, while
pacquet (v12) fails with ERR_PNPM_SUDO_NOT_SUPPORTED. Read-only
global commands (bin, root, prefix, list, outdated, config get, ...)
still work, and plain root sessions without SUDO_USER are unaffected.

The TypeScript check lives in pnpm11/pnpm/src/checkSudo.ts and runs
once the reporter is initialized, so the warning is not published to
a bus nobody is subscribed to yet. The pacquet check lives in
crates/cli/src/cli_args/sudo_guard.rs and runs before the
pre-command package-manager switch, so pnpm never delegates to a
downloaded CLI as root either.

Related to #13096.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BREAKING CHANGE(fs): stop changing folder permissions

2 participants