
Research
Malicious npm Package Brand-Squats TanStack to Exfiltrate Environment Variables
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.
Interface to read a standard Unix passwd, shadow and group file-format
npm install etc-passwd
var passwd = require('etc-passwd');
Get all users found in file. This functions returns an instance of EventEmitter.
The optional parameter file defaults to /etc/passwd
Returns an object whenever a user is found
Called when the file is done being read
If a callback is supplied as the last argument, the entire file will be read at once, and the results will be returned as a list of user objects. This is good for convenience, but can produce unnecessary overhead on systems with a lot of users.
Look for a specific username in file (defaults to /etc/passwd). This will use the
EventEmitter to avoid loading the entire file into memory and return the callback
when the user is found. If the user is not found err will be set and user will be null.
You can specify any attribute to look for as the first argument.
Get all groups found in file. This functions returns an instance of EventEmitter.
The optional parameter file defaults to /etc/group
Returns an object whenever a group is found
Called when the file is done being read
If a callback is supplied as the last argument, the entire file will be read at once, and the results will be returned as a list of group objects. This is good for convenience, but can produce unnecessary overhead on systems with a lot of groups.
Look for a specific groupname in file (defaults to /etc/group). This will use the
EventEmitter to avoid loading the entire file into memory and return the callback
when the group is found. If the group is not found err will be set and group will be null.
You can specify any attribute to look for as the first argument.
Get all shadow entries found in file. This functions returns an instance of EventEmitter.
The optional parameter file defaults to /etc/shadow
Returns an object whenever a shadow entry is found
Called when the file is done being read
If a callback is supplied as the last argument, the entire file will be read at once, and the results will be returned as a list of shadow objects. This is good for convenience, but can produce unnecessary overhead on systems with a lot of shadow entries.
Look for a specific username in file (defaults to /etc/shadow). This will use the
EventEmitter to avoid loading the entire file into memory and return the callback
when the shadow-entry is found. If the shadow entry is not found err will be set and shadow will be null.
You can specify any attribute to look for as the first argument.
An example of using the EventEmitter interface to find users
var passwd = require('passwd'),
users = passwd.getUsers();
users.on('user', function(user) {
console.log(JSON.stringify(user));
});
users.on('end', function() {
console.log('Done.');
});
{"username":"nobody","password":"*","uid":-2,"gid":-2,"comments":"Unprivileged User","home":"/var/empty","shell":"/usr/bin/false"}
{"username":"root","password":"*","uid":0,"gid":0,"comments":"System Administrator","home":"/var/root","shell":"/bin/sh"}
...
Done.
Using the callback instead of the EventEmitter to get the results
var passwd = require('passwd');
passwd.getUsers(function(users) {
console.log(JSON.stringify(users));
});
[
{"username":"nobody","password":"*","uid":-2,"gid":-2,"comments":"Unprivileged User","home":"/var/empty","shell":"/usr/bin/false"},
{"username":"root","password":"*","uid":0,"gid":0,"comments":"System Administrator","home":"/var/root","shell":"/bin/sh"},
...
]
As for a specific user on the system
var passwd = require('etc-passwd');
passwd.getUser({'username':'root'}, function(err, user) {
console.log(JSON.stringify(user));
});
{
"username": "root",
"password": "*",
"uid": 0,
"gid": 0,
"comments": "System Administrator",
"home": "/var/root",
"shell": "/bin/sh"
}
An example of using the EventEmitter interface to find groups
var passwd = require('passwd'),
groups = passwd.getGroups();
groups.on('group', function(group) {
console.log(JSON.stringify(group));
});
groups.on('end', function() {
console.log('Done.');
});
{"groupname":"nobody","password":"*","gid":-2,"users":[]}
{"groupname":"nogroup","password":"*","gid":-1,"users":[]}
...
Done.
Using the callback instead of the EventEmitter to get the results
var passwd = require('passwd');
passwd.getGroups(function(groups) {
console.log(JSON.stringify(groups));
});
[
{"groupname":"nobody","password":"*","gid":-2,"users":[]}
{"groupname":"nogroup","password":"*","gid":-1,"users":[]}
...
]
var passwd = require('etc-passwd');
passwd.getGroup({'groupname':'wheel'}, function(err, group) {
console.log(JSON.stringify(group));
});
{
"groupname": "wheel",
"password": "*",
"gid": 0,
"users": [
"root"
]
}
MIT Licensed
FAQs
Interface to read a standard Unix passwd and group file-format
The npm package etc-passwd receives a total of 1,149 weekly downloads. As such, etc-passwd popularity was classified as popular.
We found that etc-passwd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.