Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The getpass npm package is used to securely prompt for a user's password in a Node.js application. It can be used to handle password input without echoing the password back to the console, thus providing a more secure way to collect sensitive information from users.
Get User Password
This feature allows you to prompt the user for a password without echoing it to the console. The password is passed to a callback function.
const getpass = require('getpass');
getpass.getPass('Password: ', function(err, password) {
if (err) throw err;
console.log('Your password is: ' + password);
});
The 'prompt' package is a comprehensive library for getting user input in Node.js applications. It supports not only password fields but also other types of input. It is more feature-rich compared to getpass, which focuses solely on password input.
Inquirer.js is a common interactive command-line user interface that includes password prompts among many other types of prompts. It is more versatile and customizable than getpass, which is specialized for password retrieval.
Readline-sync is a synchronous readline for interactively running to have a conversation with the user via a console(TTY). It can also handle password input like getpass but offers synchronous operation and additional input types.
Get a password from the terminal. Sounds simple? Sounds like the readline
module should be able to do it? NOPE.
npm install --save getpass
const mod_getpass = require('getpass');
mod_getpass.getPass([options, ]callback)
Gets a password from the terminal. If available, this uses /dev/tty
to avoid
interfering with any data being piped in or out of stdio.
This function prints a prompt (by default Password:
) and then accepts input
without echoing.
Parameters:
options
, an Object, with properties:
prompt
, an optional Stringcallback
, a Func(error, password)
, with arguments:
error
, either null
(no error) or an Error
instancepassword
, a StringFAQs
getpass for node.js
The npm package getpass receives a total of 16,064,267 weekly downloads. As such, getpass popularity was classified as popular.
We found that getpass 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.