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.
@healerlab/device-js
Advanced tools
npm i @healerlab/device-js
with pnpm:
pnpm add @healerlab/device-js
with yarn:
yarn add @healerlab/device-js
Add it to your file or component:
import { detectDevice } from '@healerlab/device-js'
or
import pkg from '@healerlab/device-js';
const { detectDevice } = pkg;
That's it, you can now use detectDevice
in your app ✨
You can use these flags to detect the device type.
detectDevice.isDesktop
detectDevice.isMobile
detectDevice.isTablet
detectDevice.isMobileOrTablet
detectDevice.isDesktopOrTablet
detectDevice.isIos
detectDevice.isWindows
detectDevice.isMacOS
detectDevice.isApple
detectDevice.isAndroid
detectDevice.isFirefox
detectDevice.isEdge
detectDevice.isChrome
detectDevice.isSafari
detectDevice.isSamsung
detectDevice.isCrawler
detectDevice.userAgent
The user agent is also injected an accessible with detectDevice.userAgent
.
You can use detectDevice inside a script
to access the flags.
<script setup>
import { detectDevice } from '@healerlab/device-js'
// or
import pkg from '@healerlab/device-js';
const { detectDevice } = pkg;
</script>
<template>
<section>
<div v-if="detectDevice.isDesktop">
Desktop
</div>
<div v-else-if="detectDevice.isTablet">
Tablet
</div>
<div v-else>
Mobile
</div>
</section>
</template>
If the user-agent
is Amazon CloudFront
, this module checks the following headers :
CloudFront-Is-Mobile-Viewer
CloudFront-Is-Tablet-Viewer
CloudFront-Is-Desktop-Viewer
CloudFront-Is-Ios-Viewer
CloudFront-Is-Android-Viewer
Here are the details about the headers:
Amazon CloudFront - Headers for determining the viewer's device type
isWindows
and isMacOS
flags are not available with CloudFront.
This module checks the header CF-Device-Type
.
Here are the details about the header: https://support.cloudflare.com/hc/en-us/articles/229373388-Cache-Content-by-Device-Type-Mobile-Tablet-Desktop-
This module uses crawler-user-agents to generate the regular expression that detect a crawler.
This module inspired by @nuxtjs/device module
FAQs
Powerful, lightweight device detector module
The npm package @healerlab/device-js receives a total of 4 weekly downloads. As such, @healerlab/device-js popularity was classified as not popular.
We found that @healerlab/device-js 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.