New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

downgrade-identity

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downgrade-identity

simple, flexible method for downgrading process identity

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

downgrade-identity

This module implements a single, flexible method for downgrading process identity, e.g. after listening to a privileged port. Out of the box it supports user/group identity specified via npm command line arguments or via the standard SUDO_ environment variables, or it can be provide a custom options object.

Install

    npm install downgrade-identity

Usage

Following examples all assume a server.js like this:

var http = require("http"),
    argv = require("optimist").argv,
    downgradeIdentity = require("downgrade-identity");

downgradeIdentity.verbose = true;

var server =  http.createServer().on("listening", downgradeIdentity);
server.listen(80);

no args

Won't work because I'm not a privileged user.

% node test.js
initial process identity is 113/113

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EACCES

sudo

Will downgrade to identity pulled from SUDO_ environment variables.

% sudo env | grep SUDO
SUDO_COMMAND=/usr/bin/env
SUDO_USER=femto113
SUDO_UID=113
SUDO_GID=113
% sudo node test.js
initial process identity is 0/0
process identity downgraded to 113/113
    

npm command line

Will downgrade to specified identity pulled from npm_config_ environment variables.

% sudo npm start --setuid=113 --setgid=113

> node-downgrade-identity@0.1.0 start /home/femto113/node-downgrade-identity
> node server.js

initial process identity is 0/0
process identity downgraded to 113/113

optimist command line

Downgrade to specified identity provided via opts export.

% sudo node server.js --setuid 113 --setgid 113  
% sudo node server.js --setuid 113 --setgid 113
initial process identity is 0/0
process identity downgraded to 113/113

FAQs

Package last updated on 25 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc