Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
cookie-interceptor
Advanced tools
A simple JavaScript utility library for intercepting browser cookies
A simple JavaScript utility library for intercepting browser cookies
Live demo available at here.
$ npm install cookie-interceptor
The CDN build is also available on unpkg:
import CookieInterceptor from 'cookie-interceptor';
CookieInterceptor.init(); // Hijack the `document.cookie` object
CookieInterceptor.read.use(function (cookie) {
console.log('logger: ', cookie);
return cookie;
});
CookieInterceptor.disableRead().disableWrite();
document.cookie = 'date=20180915';
console.log(document.cookie); // => ''
CookieInterceptor.enableRead().enableWrite();
document.cookie = 'name=john';
console.log(document.cookie); // => 'name=john'
You can intercept document.cookie
before it is read or written.
CookieInterceptor.read.use(function (cookie) {
console.log(cookie);
return cookie;
});
CookieInterceptor.write.use(function (val) {
console.log(val);
return val;
});
read.enabled
/ readEnabled
: Check if the cookie is readable.read.enable()
/ enableRead()
: Enable READ
flag. You can read all cookies
with document.cookie
property.read.disable()
/ disableRead()
: Disable READ
flag. document.cookie
will return an empty string.write.enabled
/ writeEnabled
: Check if the cookie is writable.write.enable()
/ enableWrite()
: Enable WRITE
flag. You can write a new
cookie or update an existing cookie.write.disable()
/ disableWrite()
: Disable WRITE
flag.
document.cookie="key=value"
will not write a new cookie or update an
existing cookie.IE / Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
IE9, IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
MIT
FAQs
A simple JavaScript utility library for intercepting browser cookies
The npm package cookie-interceptor receives a total of 382 weekly downloads. As such, cookie-interceptor popularity was classified as not popular.
We found that cookie-interceptor 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
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.