Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/cockroachdb/apd/v2
apd is an arbitrary-precision decimal package for Go.
apd
implements much of the decimal specification from the General Decimal Arithmetic description. This is the same specification implemented by python’s decimal module and GCC’s decimal extension.
math/big
types don’t return errors, and instead panic under some conditions that are documented. This requires users to validate the inputs before using them. Meanwhile, we’d like our decimal operations to have more failure modes and more input requirements than the math/big
types, so using that API would be difficult. apd
instead returns errors when needed.sqrt
, ln
, pow
, etc.apd
supports traps which will trigger an error on any of these conditions. This makes it possible to guarantee exactness in computations, if needed.apd
has two main types. The first is Decimal
which holds the values of decimals. It is simple and uses a big.Int
with an exponent to describe values. Most operations on Decimal
s can’t produce errors as they work directly on the underlying big.Int
. Notably, however, there are no arithmetic operations on Decimal
s.
The second main type is Context
, which is where all arithmetic operations are defined. A Context
describes the precision, range, and some other restrictions during operations. These operations can all produce failures, and so return errors.
Context
operations, in addition to errors, return a Condition
, which is a bitfield of flags that occurred during an operation. These include overflow, underflow, inexact, rounded, and others. The Traps
field of a Context
can be set which will produce an error if the corresponding flag occurs. An example of this is given below.
See the examples for some operations that were previously difficult to perform in Go.
FAQs
Unknown package
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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.