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

@dhis2/app-service-offline

Package Overview
Dependencies
Maintainers
15
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dhis2/app-service-offline - npm Package Compare versions

Comparing version 2.12.1 to 2.12.2

11

build/cjs/lib/__tests__/clear-sensitive-caches.test.js

@@ -50,2 +50,13 @@ "use strict";

});
it('returns false if caches.keys throws', async () => {
const spy = jest.fn(() => {
throw new Error('Security Error');
});
window.caches = {
keys: spy
};
const result = await (0, _clearSensitiveCaches.clearSensitiveCaches)();
expect(spy).toHaveBeenCalled();
expect(result).toBe(false);
});
it('clears potentially sensitive caches', async () => {

@@ -52,0 +63,0 @@ const testKeys = ['cache1', 'cache2', 'app-shell'];

11

build/cjs/lib/clear-sensitive-caches.js

@@ -74,3 +74,12 @@ "use strict";

console.debug('Clearing sensitive caches');
const cacheKeys = await caches.keys();
let cacheKeys; // caches.keys can fail in insecure contexts, see:
// https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage
try {
cacheKeys = await caches.keys();
} catch (e) {
// Return false since no caches have been cleared
return false;
}
return Promise.all([// (Resolves to 'false' because this can't detect if anything was deleted):

@@ -77,0 +86,0 @@ clearDB(dbName).then(() => false), // Remove caches if not in keepable list

8

build/cjs/lib/offline-interface.js

@@ -48,9 +48,5 @@ "use strict";

}) => message, ({
action,
onConfirm
actions
}) => ({
actions: [{
label: action,
onClick: onConfirm
}],
actions,
permanent: true

@@ -57,0 +53,0 @@ }));

@@ -42,2 +42,13 @@ import FDBFactory from 'fake-indexeddb/lib/FDBFactory';

});
it('returns false if caches.keys throws', async () => {
const spy = jest.fn(() => {
throw new Error('Security Error');
});
window.caches = {
keys: spy
};
const result = await clearSensitiveCaches();
expect(spy).toHaveBeenCalled();
expect(result).toBe(false);
});
it('clears potentially sensitive caches', async () => {

@@ -44,0 +55,0 @@ const testKeys = ['cache1', 'cache2', 'app-shell'];

@@ -65,3 +65,12 @@ // IndexedDB names; should be the same as in @dhis2/pwa

console.debug('Clearing sensitive caches');
const cacheKeys = await caches.keys();
let cacheKeys; // caches.keys can fail in insecure contexts, see:
// https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage
try {
cacheKeys = await caches.keys();
} catch (e) {
// Return false since no caches have been cleared
return false;
}
return Promise.all([// (Resolves to 'false' because this can't detect if anything was deleted):

@@ -68,0 +77,0 @@ clearDB(dbName).then(() => false), // Remove caches if not in keepable list

@@ -31,9 +31,5 @@ import { useAlert } from '@dhis2/app-service-alerts';

}) => message, ({
action,
onConfirm
actions
}) => ({
actions: [{
label: action,
onClick: onConfirm
}],
actions,
permanent: true

@@ -40,0 +36,0 @@ }));

{
"name": "@dhis2/app-service-offline",
"description": "A runtime service for online/offline detection and offline caching",
"version": "2.12.1",
"version": "2.12.2",
"main": "./build/cjs/index.js",

@@ -36,3 +36,3 @@ "module": "./build/es/index.js",

"peerDependencies": {
"@dhis2/app-service-alerts": "2.12.1",
"@dhis2/app-service-alerts": "2.12.2",
"prop-types": "^15.7.2",

@@ -39,0 +39,0 @@ "react": "^16.8.6",

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