Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Provides a wrapper around node-maxmind for getting the location data in an easy-to-read format.
Install the module by running npm install fxa-geodb --save
. Then, include the module in your source file, like so:
var geoDb = require('fxa-geodb')();
You can also pass other options
like the path to the database to the require
statement, like so:
var geoDb = require('fxa-geodb')({
dbPath: 'cities-db.mmdb' // Defaults to fxa-geodb/db/cities-db.mmdb
});
--
The function returns a location object or throws if the ip was invalid or location data could not be found. Call the function like so:
try {
const location = geoDb(ip);
// Use location...
} catch (err) {
// Handle err
}
The location
object has the following properties:
accuracy
: Accuracy radius in km (number)city
: Human readable city name (string)state
: Human readable state name (string)stateCode
: ISO 3166-2 state code (string)country
: Human readable country name (string)countryCode
: ISO 3166-1 alpha-2 country code (string)continent
: Human readable continent name (string)timeZone
: IANA tz database timezone (string)latLong
: An object containing two properties:
latitude
: Latitude (number)longitude
: Longitude (number)For example:
{
accuracy: 5,
city: 'Mountain View',
state: 'California',
stateCode: 'CA',
country: 'United States',
countryCode: 'US',
continent: 'North America',
timeZone: 'America/Los_Angeles'
latLong: {
latitude: 37.3885,
longitude: -122.0741
}
}
A working example is provided in the examples
directory.
--
Mocha Tests are located in the test
subdirectory. To run the tests, call npm test
.
--
Code coverage is provided with Istanbul
, to run coverage, call npm run-script cover
--
A Cron job is provided in lib/maxmind-db-downloader
, that can be configured and run like so:
var maxmindDbDownloader = new MaxmindDbDownloader();
var targetDirPath = maxmindDbDownloader.createTargetDir('db-name');
var downloadPromiseFunctions = maxmindDbDownloader.setupDownloadList(
path.join(__dirname, '..','path-to-sources-file'),
targetDirPath
);
maxmindDbDownloader.setupAutoUpdate('30 30 1 * * 3', downloadPromiseFunctions);
By default, the cron job runs every week on Wednesday at 01:30:30 (UTC -7) and updates the Geodata-DB from Maxmind.
--
Interested in contributing to the development of Firefox Accounts GeoDB repo? Great! Head over to the #fxa channel on irc.mozilla.org with questions, or jump ahead and fix any of the issues we have.
Please review and understand the Mozilla Community Participation Guidelines before contributing to this project. Also, following the commit guidelines is greatly appreciated.
--
You can file issues here on GitHub. Please try to include as much information as you can and under what conditions you saw the issue.
--
This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.
--
FAQs
Firefox Accounts GeoDB Repo for Geolocation based services
The npm package fxa-geodb receives a total of 132 weekly downloads. As such, fxa-geodb popularity was classified as not popular.
We found that fxa-geodb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.