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.
depreciator
Advanced tools
Sometimes a it is nice to know which version of data a function is passed. Especially in NoSQL land it can be used to ensure some kind of schema, and handle changes transparently.
Todo this Depreciator assumes that the data contains a numeric version under the key __version
{ __version: 1, something: 'else', can: 'be here' }
This version is checked against the ensured, and actions can be take for it. No version present assumes a 0.
For depreciator to hook the functions it need to be required and enabled for a given module
var depreciator = require('depreciator')
var myThing = {
myFunc: function(thing, param, stuff) {
doGreatThings(thing, param, stuff)
},
func: function(thing, stuff) {
doAwesomeStuff(thing, stuff)
}
}
module.exports = depreciator.enable(myThing)
Now versions can be ensured on the functions, it will check the first argument to the function for it's __version field.
ensure version for just this function
depreciator.ensure(2, 'myFunc')
ensure version globally for every function in the module it is enabled for.
depreciator.ensure(1)
ensure version for just this function and call fallback if versions don't match
version.ensure(3, 'func', function(thing, version, expectedVersion) {
console.log("you are old")
})
install a global fallback function to be called on version missmatch
version.ensure(1, function(thing, version, expected) {
console.log("OLD!!!")
})
register hook for when versions are not satisfied hooks are run before the function is called
version.registerMismatchHook(function(thing, version, expected) {
console.log("OLD!!!")
})
MIT
FAQs
versioning for object function arguments
The npm package depreciator receives a total of 0 weekly downloads. As such, depreciator popularity was classified as not popular.
We found that depreciator 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.