
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
High CVE
Selective error catching and rewrite rules
Lead Maintainer - Eran Hammer
Working with async
/await
introduces a new challange in handling errors. Unlike callbacks, which
provide a dual mechanism for passing application errors via the callback err
argument and
developer errors via exceptions, await
combines these two channels into one.
It is common practice to ignore application errors in background processing or when there is no useful fallback. In those cases, it is still imperative to allow developer errors to surface and not get swallowed.
For more information read:
For example:
async function email(user) {
if (!user.address) {
throw new Error('User has no email address');
}
const message = 'Welcome!';
if (user.name) {
message = `Welcome ${user.name}!`;
}
await mailer.send(user.address, message);
}
async function register(address, name) {
const user = { address, name };
const id = await db.user.insert(user);
user.id = id;
try {
await email(user);
}
catch (err) { } // Ignore errors
return user;
}
This will fail silently every time the user has a name
because it is reassigning a value to a
const
variable. However, because email()
errors are ignored, system errors are ignored as well.
The idea is that email()
can be used in both critical and non-critical paths. In the critical
paths, errors are checked and addressed, but in the non-critical paths, errors are simply ignored.
This can be solved by adding a rethrow()
statement:
const Bounce = require('bounce');
async function register(address, name) {
const user = { address, name };
const id = await db.user.insert(user);
user.id = id;
try {
await email(user);
}
catch (err) {
Bounce.rethrow(err, 'system'); // Rethrows system errors and ignores application errors
}
return user;
}
rethrow(err, types, [options])
Throws the error passed if it matches any of the specified rules where:
err
- the error.type
- a single item or an array of items of:
SyntaxError
).'system'
- matches any languange native error or node assertions.'boom'
- matches boom errors.options
- optional object where:
decorate
- an object which is assigned to the err
, copying the properties onto the error.override
- an error used to override err
when err
matches. If used with decorate
,
the override
object is modified.return
- if true
, the error is returned instead of thrown. Defaults to false
.ignore(err, types, [options])
The opposite action of rethrow()
. Ignores any errors matching the specified types
. Any error
not matching is thrown after applying the options
.
background(operation, [action], [types], [options])
Awaits for the value to resolve in the background and then apply either the rethrow()
or ignore()
actions where:
operation
- a function, promise, or value that is await
ed on inside a try...catch
and any
error thrown processed by the action
rule.action
- one of 'rethrow'
or 'ignore'
. Defaults to 'rethrow'
.types
- same as the types
argument passed to rethrow()
or ignore()
. Defaults to 'system'
.options
- same as the options
argument passed to rethrow()
or ignore()
.isBoom(err)
Returns true
when err
is a boom error.
isError(err)
Returns true
when err
is an error.
isSystem(err)
Return true
when err
is one of:
EvalError
RangeError
ReferenceError
SyntaxError
TypeError
URIError
AssertionError
FAQs
Selective error catching and rewrite rules
The npm package bounce receives a total of 21,329 weekly downloads. As such, bounce popularity was classified as popular.
We found that bounce 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 deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.