
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
stateless-captcha
Advanced tools
Node module to handle rendering and validating a captcha in stateless fashion.
Node module to easily implement stateless captcha rendering and validations, for use in express and restify. You can easily define the three routes needed to support a captcha protected function in your applications
app.post('/captcha', captchaHandler.getCaptcha); app.post('/captcha/verify', captchaHandler.verifyCaptcha);
and finally your captcha protected route with middleware
app.get('/', captchaHandler.verifyJWTResponseMiddleware, (req, res) => res.send('Hello There! You must have entered a valid Captcha response') );
This module provides functionality to add 3 routes and 1 middleware function to your restify or express application.
const express = require('express'); const app = express(); const captcha = require('stateless-captcha'); const bodyParser = require('body-parser'); const port = 3000; const options = { CAPTCHA_TOKEN_HEADER: 'authorization', CAPTCHA_NONCE_HEADER: 'captcha-nonce', CAPTCHA_TOKEN_SECRET: 'defaultSecret', CAPTCHA_EXPIRY_MINUTES: '15' }; const captchaHandler = captcha(options); // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })); // parse application/json app.use(bodyParser.json()); /** Getting the Captcha for your front-end * Submit: a client side nonce * { * nonce: '1223dsfdres-434-dd' * }; * * the returned object containes the captcha as well as the encrypted validation for future use. * { * "captcha": { * "data": "svg ... " * }, * "validation": "ksafrp348573pfsldkfjlj.............." * }; */ app.post('/captcha', captchaHandler.getCaptcha); /** verify the user's answer * Submit: an object with the nonce, the anser and the validation string. * { * nonce: '1223dsfdres-434-dd', * answer: 'mk4f8h', * validation: "ksafrp348573pfsldkfjlj.............." * }; * * the returned obect: * { * "valid": true, * "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6Ik....." * } */ app.post('/captcha/verify', captchaHandler.verifyCaptcha); /** Secure a route using the jwt token obtained with the correct answer, we're using middleware for this * both the token and the nonce are required to be submitted in the request headers * the token may be preceded by 'Bearer ' even if the header is not 'authorization' */ app.get('/', captchaHandler.verifyJWTResponseMiddleware, (req, res) => res.send('Hello There! You must have entered a valid Captcha response') ); // start the app !! app.listen(port, () => console.log(`Example app listening on port ${port}!`));
FAQs
Node module to handle rendering and validating a captcha in stateless fashion.
The npm package stateless-captcha receives a total of 5 weekly downloads. As such, stateless-captcha popularity was classified as not popular.
We found that stateless-captcha 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.