Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Readme
Safe and minimal spying tool for testing purposes.
npm install spyn --save-dev
Takes a function and returns a function that is being spied on.
const spiedFn = spy(sum)
spiedFn(1, 2) // => 3
There is also a optional configuration object which allows you to define what function call properties are stored in the calls array. By default it stores arguments and return values.
const spiedFn = spy(sum, {arguments: false, this: true})
spiedFn.call('thiz', 'a', 'b') // => 'ab'
calls(spiedFn) // => [{this: 'thiz', return: 'ab'}]
Takes a spy function and returns an array containing information of each call
const spiedFn = spy(multiply)
spiedFn(1,2)
calls(spiedFn) // => [{arguments: [1,2], return: 2}]
Returns the original function of the spy.
const spiedFn = spy(divide)
spiedFn === divide // => false
original(spiedFn) === divide // => true
Spies tend to be used only in tests. They allow you to observe and automate the checking of function calls.
It is good practice to remove a spy when the test has completed. This prevents edge cases.
npm install && npm test
FAQs
Simple and safe spy tool for tests
We found that spyn 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
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.