New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

csrf-monkey

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csrf-monkey - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

7

package.json
{
"name": "csrf-monkey",
"version": "1.0.3",
"description": "Monkeypatch xhr and fetch to automatically add csrf tokens to clientside requests",
"version": "1.0.4",
"description": "Automatically add CSRF headers to all clientside requests",
"main": "index.js",

@@ -48,4 +48,5 @@ "scripts": {

"xhr",
"fetch"
"fetch",
"monkey"
]
}

@@ -6,8 +6,8 @@ [![Travis CI](https://travis-ci.org/alanclarke/csrf-monkey.svg?branch=master)](https://travis-ci.org/alanclarke/csrf-monkey)

# csrf-monkey
Clientside csrf made simple
Automatically add CSRF headers to all clientside requests
- handles both xhr and fetch
- small footprint, no dependencies
- configurable, testable and restorable
- handles both xhr and fetch
- 100% test coverage
- small footprint, no dependencies

@@ -34,10 +34,8 @@ ## Installation

Then call `csrf-monkey` to patch xhr and window.fetch to automatically include the csrf token in all requests
Then call `csrf-monkey`. This will patch xhr and window.fetch so that your csrf token is automatically included in all clientside requests
```js
var axios = require('axios')
var csrfMonkey = require('csrf-monkey')
csrfMonkey()
require('csrf-monkey')()
fetch('/api') // request will include csrf header ('x-csrf-token': value)

@@ -47,7 +45,6 @@ axios.get('/api') // request will include csrf header ('x-csrf-token': value)

## Options
```js
// csrfMonkey(header, token)
var csrfMonkey = require('csrf-monkey')
csrfMonkey(header, token)

@@ -54,0 +51,0 @@ // you can also pass a custom header to csrf-monkey:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc