
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
csrf-monkey
Advanced tools
Automatically add CSRF headers to all clientside requests
npm install --save csrf-monkey
Default behaviour
Put your csrf token in a meta tag in your head like so:
<html>
<head>
<meta name='csrf-token' content='value'>
</head>
<body></body>
</html>
Then call csrf-monkey
. This will patch xhr and window.fetch so that your csrf token is automatically included in all clientside requests
var axios = require('axios')
require('csrf-monkey')()
fetch('/api') // request will include csrf header ('x-csrf-token': value)
axios.get('/api') // request will include csrf header ('x-csrf-token': value)
var csrfMonkey = require('csrf-monkey')
csrfMonkey(header, token)
// you can also pass a custom header to csrf-monkey:
csrfMonkey('my-custom-csrf-header')
// and you can pass your csrf token value directly to csrf-monkey if you don't want to include it as a meta tag:
csrfMonkey(null, 'my-csrf-token')
var restore = csrfMonkey()
restore() // Restores everything back to how it was
csrf-xhr
FAQs
Automatically add CSRF headers to all clientside requests
The npm package csrf-monkey receives a total of 3 weekly downloads. As such, csrf-monkey popularity was classified as not popular.
We found that csrf-monkey 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
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.