Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
flask-simple-captcha-k-fork
Advanced tools
Extremely simple, "Good Enough" captcha implemention for flask forms. No server side sessions required.
Install from pypi
pip install flask-simple-captcha-k-fork
Install from source
python3 setup.py install
This package is intended to assign a unique CSRF string per each form submit per user session, without requiring any backend session tracking. First, you'll want to set a variable CAPTCHA_CONFIG['SECRET_CAPTCHA_KEY']
in your app config to a random, complex string. Example: CAPTCHA_CONFIG = {'SECRET_CAPTCHA_KEY':'wMmeltW4mhwidorQRli6Oijuhygtfgybunxx9VPXldz'}
Second, add this to the top of your code.
from flask_simple_captcha_k_fork import CAPTCHA
CAPTCHA = CAPTCHA(config=config.CAPTCHA_CONFIG)
app = CAPTCHA.init_app(app)
For each route you want captcha protected, add the following code:
@app.route('/example', methods=['GET','POST'])
def example():
if request.method == 'POST':
c_hash = request.form.get('captcha-hash')
c_text = request.form.get('captcha-text')
if CAPTCHA.verify(c_text, c_hash):
# Code to success captcha
...
else:
# Code to failed captcha
...
if request.method == 'GET':
captcha = CAPTCHA.create()
return render_template('example.html', captcha=captcha)
In the HTML forms you want to generate a captcha: {{ captcha_html(captcha) }}
This will create something like this:
<input type="text" name="captcha-text">
<input type="hidden" name="captcha-hash" value="1o9ig...">
To make a customized-size captcha, you can do:
captcha = CAPTCHA.create(length=10, digits=True)
FAQs
Extremely simple, "Good Enough" captcha implemention for flask forms. No server side sessions required.
We found that flask-simple-captcha-k-fork demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.