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.
☑ functional assertions
assert.equal
assert
methods are too long to typea.eq
- takes values or functions that transform the input
then checks for strict or deep equality of their computed values
a.eq.sync
- same as above but all functions must be sync
a.err
- checks that a provided function throws or rejects
a provided error
a.err.sync
- same as above but provided function must be sync
Basic usage
const a = require('a-sert')
a.eq(1, x => x.a, x => x.b - 1)({ a: 1, b: 2 })
// => ({ a: 1 }, { b: 2 })
a.eq(1, x => x.a)({ a: 2 })
// throws AssertionError('2 !== 1')
a.eq(x => x, { a: 1 })({ a: 1 })
// => ({ a: 1 })
a.eq(x => x, { a: 1 })({ a: 2 })
// throws AssertionError('{"a":1} !deepEqual {"a":2}')
a.err(
() => { throw new TypeError('hey') },
new TypeError('hey'),
)('yo')
// => 'yo'
a.err(
x => x,
new RangeError('hey'),
)('yo')
// => throws AssertionError('did not throw RangeError: hey')
A test in mocha
const _ = require('rubico')
const a = require('a-sert')
const connectorDynamo = require('.')
describe('connectorDynamo', () => {
it('instantiates a DynamoDB client', () => _.flow(
connectorDynamo,
a.eq('localhost', _.get('client.endpoint.hostname')),
a.eq('http:', _.get('client.endpoint.protocol')),
a.eq(8000, _.get('client.endpoint.port')),
)({
endpoint: 'http://localhost:8000',
credentials: {
access_key_id: 'hey',
secret_access_key: 'secret',
},
region: 'us-east-1',
}))
})
FAQs
☑ functional assertions
The npm package a-sert receives a total of 2 weekly downloads. As such, a-sert popularity was classified as not popular.
We found that a-sert 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
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.