Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
workbox-recipes
Advanced tools
A service worker helper library to manage common request and caching patterns
The workbox-recipes npm package provides pre-configured, common service worker strategies and behaviors for web applications using Workbox. It simplifies the implementation of caching, offline functionality, and other progressive web app (PWA) features.
Offline Page
This feature allows you to specify fallback pages or images when the network is unavailable. The code sample shows how to set up offline fallbacks for both pages and images.
import { offlineFallback } from 'workbox-recipes';
offlineFallback({
pageFallback: '/offline.html',
imageFallback: '/static/images/offline.jpg'
});
Static Resource Caching
Enables caching for static resources such as CSS and JavaScript files. The code sample demonstrates pre-caching specific URLs on service worker installation.
import { staticResourceCache } from 'workbox-recipes';
staticResourceCache({
warmupUrls: ['/styles/main.css', '/scripts/main.js']
});
Google Fonts Caching
Provides a simple method to cache Google Fonts used on your web pages, enhancing performance and reducing data usage.
import { googleFontsCache } from 'workbox-recipes';
googleFontsCache();
sw-toolbox offers various service worker tools for caching and managing requests similar to workbox-recipes. However, it is less modular and not actively maintained as Workbox, which includes workbox-recipes.
sw-precache is a tool for generating service worker code that precaches resources. It is similar to workbox-recipes in providing offline capabilities but does not offer as extensive configuration options or runtime caching strategies.
This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-recipes
FAQs
A service worker helper library to manage common request and caching patterns
The npm package workbox-recipes receives a total of 2,343,765 weekly downloads. As such, workbox-recipes popularity was classified as popular.
We found that workbox-recipes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.