Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
storm-cookie-banner
Advanced tools
Cookie banner that can categorise cookies and conditionally invoke cookie-reliant functionality based on user-consent.
Cookie banner that can categorise cookies and conditionally invoke cookie-reliant functionality based on user-consent.
https://mjbp.github.io/storm-cookie-banner
Cookie management works by categorising cookies and the functions that initialise them, encapsulating them in a configuration object.
Cookies category names can be any valid String. Preference cookies are a mandatory category that is used by the banner itself to save preferences if consented.
JS
npm i -S storm-cookie-banner
Using es6 import
import CookieBanner from 'storm-cookie-banner';
CookieBanner.init({
types: {
'necessary': {
fns: [
model => {
//function that depends upon or creates a 'necessary' cookie
}
]
},
'preference': {
checked: true, //whether the checkbox shown to the user is checked by default or not
fns: [ //array of cookie-reliant functions
model => {
//function that depends upon or creates a 'preference' cookie
}
]
},
'performance': {
checked: true,
fns: [
model => {
//function that depends upon or creates a 'performance' cookie
}
]
},
'advertising and marketing': {
checked: false,
fns: [
model => {
//function that depends upon or creates an 'Advertising and marketing' cookie
}
]
}
}
});
or aynchronous browser loading (use the .standalone version in the /dist folder)
import Load from 'storm-load';
Load('/content/js/async/storm-cookie-banner.standalone.js')
.then(() => {
StormCookieBanner.init({
types: { ... as es6 example }
});
{
name: 'CookiePreferences',
path: '/',
domain: '',
secure: '',
expiry: 365,
types: {
'necessary': {
checked: true,
disabled: true,
fns: []
},
'preference': {
checked: true,
fns: [
model => { document.cookie = writeCookie(model); }
]
}
},
classNames: {
banner: 'cookie-banner',
btn: 'cookie-banner__btn',
field: 'cookie-banner__field',
updateBtnContainer: 'cookie-banner__update',
updateBtn: 'cookie-banner__update-btn'
},
updateBtnTemplate(model){
return `<button class="${model.classNames.updateBtn}">Update cookie preferences</button>`
},
bannerTemplate(model){
return `<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="cookie-banner__desc" class="${model.classNames.banner}">
<!--googleoff: all-->
<div class="small-12" id="cookie-banner__desc">
<h1 class="cookie-banner__heading">This website uses cookies.</h1>
<p class="cookie-banner__text gamma">We use cookies to analyse our traffic and to provide social media features. You can choose which categories
of cookies you consent to, or accept our recommended settings.
<a class="cookie-banner__link" rel="noopener noreferrer nofollow" href="/cookies/">Find out more</a> about the cookies we use before you consent.</p>
<ul class="cookie-banner__list lister push--bottom large-10">
${Object.keys(model.types).map(type => `<li class="cookie-banner__list-item">
<input id="cookie-banner__${type.split(' ')[0].replace(' ', '-')}" class="${model.classNames.field}" value="${type}" type="checkbox"${model.types[type].checked ? ` checked` : ''}${model.types[type].disabled ? ` disabled` : ''}>
<label class="cookie-banner__label gamma" for="cookie-banner__${type.split(' ')[0].replace(' ', '-')}">${type.substr(0, 1).toUpperCase()}${type.substr(1)} cookies</label>
</li>`).join('')}
</ul>
</div>
<button class="${model.classNames.btn}">Continue</button>
<!--googleon: all-->
</section>`;
}
npm test
This is module has both es6 and es5 distributions. The es6 version should be used in a workflow that transpiles.
The es5 version depends unpon Object.assign so all evergreen browsers are supported out of the box, ie9+ is supported with polyfills. ie8+ will work with even more polyfils for Array functions and eventListeners.
None
MIT
FAQs
Cookie banner that can categorise cookies and conditionally invoke functionality that generates cookies based on user consent.
The npm package storm-cookie-banner receives a total of 5 weekly downloads. As such, storm-cookie-banner popularity was classified as not popular.
We found that storm-cookie-banner 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.