
Research
Using Trusted Protocols Against You: Gmail as a C2 Mechanism
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
react-cf-turnstile
Advanced tools
A React library for Cloudflare Turnstile (https://www.cloudflare.com/en-gb/products/turnstile/)
This library provides a React component that can be used to protect your site from bots and scrapers using Cloudflare Turnstile.
Basic usage can be found at the Cloudflare Turnstile Documentation.
npm i react-cf-turnstile
yarn add react-cf-turnstile
Methods can be called using a reference. Passing the widget ID is not necessary.
Name | Description |
---|---|
renderTurnstile | Calls the turnstile.render() function |
resetTurnstile | Can be used to reset the widget if it has expired or needs to be reloaded |
removeTurnstile | Removes the widget |
getResponse | soon™ |
Name | Type | Required | Description |
---|---|---|---|
sitekey | string | yes | The sitekey associated with your widget configuration on the Cloudflare Dashboard |
action | string | Information used in analytics to differentiate between widgets on the same site | |
cData | string | Payload used to attach customer data to the challenge which is returned upon validation | |
callback | callback | yes | Called when a challenge is successfully completed |
expired-callback | callback | Called when a challenge expires | |
error-callback | callback | Called when there is a network error | |
theme | string | Theme of the widget. Can be light, dark or auto | |
tabindex | number | Tabindex of the iframe for accessibility purposes |
In this example, I use the demo only sitekey provided by Cloudflare. You should use your own sitekey in production.
import React from 'react';
import CFTurnstile from 'react-cf-turnstile';
function App() {
return (
<CFTurnstile
siteKey="1x00000000000000000000AA" // change me! testing only
action="FORM_SUBMIT" // optional: used in analytics to differentiate between different turnstiles on the same site
cData="some data" // optional: read cloudflare docs for more info
callback={(token) => { // called when challenge is completed successfully
console.log(token);
}}
expired-callback={() => { // optional: called when a challenge expires
console.log('expired');
}}
error-callback={(error) => { // optional: called when an error occurs
console.error(error);
}}
theme="light" // optional: light/dark/auto
tabindex="0" // optional: tabindex for the iframe for accessibility
/>
);
}
Note: dev builds are not guaranteed to be stable and may contain breaking changes not clearly documented
npm i react-cf-turnstile@dev
yarn add react-cf-turnstile@dev
FAQs
A React library for Cloudflare Turnstile (https://www.cloudflare.com/en-gb/products/turnstile/)
The npm package react-cf-turnstile receives a total of 8 weekly downloads. As such, react-cf-turnstile popularity was classified as not popular.
We found that react-cf-turnstile 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
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.