
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
basic-auth-http
Advanced tools
A simple object to implement http basic authentication.
import {Basic as auth} from 'basic-auth-http';
const app = express();
const auth = new Auth({
file: '/path/to/user-password-pairs'
});
app.use((req, res, next) => {
// returns 401 Unauthorized if check doesn't pass (the callback is not called, no next).
auth.check(req, res, (err: Error) => {
if (err) {
next(err);
}
else {
next();
}
});
});
You can check the test for more details
yarn add basic-auth-http
This is just a bit of code that I wrote for testing and for implementing in a private architecture. Use with caution. If you really want to secure your application you should also make use of https to encrypt the headers because http authorization is sending plain passwords in the request. If you wish to contribute you can propose a PR on the related github, I'd be glad to improve this tiny api.
FAQs
A simple object to implement http basic authentication.
We found that basic-auth-http 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.