Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
config_okay
Advanced tools
This became a module because I used it more than once.
It is really simple. All it does is parse a config file. Borrowing from postgresql, it refuses to do anything if the config file isn't chmod 0600. I don't even know what that means in the Windows or Mac world, so patches welcome. Essentially, if a file is not set such that only the owner can read and write it, then it isn't a good idea to store passwords in it.
So, if you have a config file of any sort, and it is set to be chmod 0600, then you can use this file.
What is does is check the permissions of the file, then it requires it and returns the results of the require statement.
According to the node.js docs, require will pull in either a javascript file, or a JSON file.
npm install config_okay
The older version you would do this:
var config_okay = require('config_okay')
var configfile = 'config.json' // or pull from the command line or something
config_okay(configfile,function(err,config){
if(err){
throw new Error('node.js needs a good croak module')
}
do_something(config)
})
Now that isn't true anymore because as of May 2017 I've switched to using promises.
So now the usage is
const config_okay = require('config_okay')
const configfile = 'config.json' // or pull from the command line or something
config_okay(configfile)
.then(config => {
return do_something(config)
})
.catch( e => {
return handleError(e)
})
Look at the test file to see what I mean.
FAQs
Make sure config files are mode 0600 before you use it
We found that config_okay 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.
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.