downgrade-root
Advanced tools
Comparing version 1.0.0 to 1.1.0
'use strict'; | ||
var isRoot = require('is-root'); | ||
var defaultUid = require('default-uid'); | ||
module.exports = function () { | ||
if (isRoot() && process.setuid) { | ||
process.setuid(501); | ||
var uid = parseInt(process.env.SUDO_UID, 10) || defaultUid(); | ||
if (uid && uid > 0) { | ||
process.setuid(uid); | ||
} | ||
} | ||
}; |
{ | ||
"name": "downgrade-root", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Try to downgrade the permissions of a process with root privileges", | ||
@@ -35,2 +35,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"default-uid": "^1.0.0", | ||
"is-root": "^1.0.0" | ||
@@ -37,0 +38,0 @@ }, |
@@ -5,5 +5,7 @@ # downgrade-root [![Build Status](https://travis-ci.org/sindresorhus/downgrade-root.svg?branch=master)](https://travis-ci.org/sindresorhus/downgrade-root) | ||
Usually a process started with `sudo`. | ||
Usually applies to a process started with `sudo`. | ||
Windows is gracefully ignored as it lacks a way to [set UID](http://nodejs.org/api/process.html#process_process_setuid_id). | ||
## Install | ||
@@ -10,0 +12,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3009
11
38
0
2
2
+ Addeddefault-uid@^1.0.0
+ Addeddefault-uid@1.0.0(transitive)