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.
@segment/in-regions
Advanced tools
🔒Privacy-first location detection library for browsers
in-regions
is a library for roughly detecting whether or not a website user is in a given "region". without requiring a roundtrip to your server or a lookup against a GeoIP database.
It uses the browser's timezone (via the brilliant jstz and locale (navigator.languages) to infer a user's location. in-regions
trades absolute accuracy for a cautious approach that's more lightweight and respectful of end-user privacy.
At Segment, we use in-regions
to ask the question "Should we ask this user for their consent before tracking first-party data?". Because of this, we believe in casting a wider net, and are fine with trading accuracy for a more respectful approach towards consent.
As we prepare for CCPA, in-regions
supports "EU" and individual US states and territories (via npm package 'us') as valid regions.
npm install @segment/in-regions
Use in-regions
to generate your own custom location method. Our inRegions
function is a higher-order function that returns a custom function for your custom use cases.
For example, to generate a function that tests whether or not a user is in the EU:
import inRegions from '@segment/in-regions'
const inEU = inRegions(["EU"])
// => () => true/false
If you wanted to include both residents of California and EU residents (like we are!):
const inCustomRegion = inRegions(["EU", "CA"])
const isInCustomRegion = inCustomRegion() // isInCustomRegion would be 'true' if current user is in EU or CA
in-regions
also wraps, and exports all methods available in in-eu:
import { isInEUTimezone, isEULocale, inEU } from '@segment/in-eu'
/*
Only checks the browser timezone.
Useful for checking if someone is physically present in the EU
*/
isInEUTimezone()
// => true | false
/*
Only uses the browser's language/locale
Useful for checking if someone speaks an european language accounting
for locale. e.g. pt-PT (portuguese from Portugal)
*/
isEULocale()
// => true | false
inEU()
// => true | false
FAQs
🔒Privacy-first location detection library for browsers
The npm package @segment/in-regions receives a total of 25,662 weekly downloads. As such, @segment/in-regions popularity was classified as popular.
We found that @segment/in-regions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 250 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.