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.
Built for plate; determines (roughly) the timezone name based on a few lovely factors.
Adds two prototype methods to Date
.
Get a formated, GMT+0000
-style offset string for your locale, based on the result of
Date.prototype.getTimezoneOffset
.
Returns an object with the following information if tzinfo exists for your locale's offset
(as returned by Date.prototype.getTimezoneOffset
):
{
'name' : 'Human Readable Name of Area'
, 'loc' : 'Location of TZ: E.G., North America'
, 'abbr' : 'shortname for tz: E.G, CST'
, 'offset': '(+|-)0XXX'
}
The TZINFO is collected in tz.json
.
Fuzzily. A list of known TZ data is stored in tz.json
, keyed by offset (+0000
, -0600
).
The ordering of the list is important. Roughly, the algorithm does the following:
Get the offset string from your date.
Lookup the list of TZ's corresponding to that offset.
Determine whether your timezone has Daylight Savings.
Determine the thresholds at which Daylight Savings Time takes effect in your locale, if any.
Determine, based on that, whether your locale is in the northern or southern hemisphere. Default to southern hemisphere.
How does that work?
If you're in the northern hemisphere, the threshold for "spring forward" will be earlier than "fall back".
In the south, this is reversed.
If your locale is currently in DST, filter the TZ list for names that match /([Dd]aylight|[Ss]ummer)/
.
If your locale is in the south (or we have no DST info), reverse the list.
Return the first time from that list as the TZinfo.
Why default to the south?
For countries that have DST, we can easily determine which half of the Earth they're on. For countries that don't, we're forced to guess. However, if we approach from the South, we tend to pick up countries of interest.
$ git clone git@github.com:chrisdickinson/tz.js.git
$ cd tz.js
$ make build
$ # now you have tz.js, and if you have uglifyjs or jsmin, you also have tz.min.js
npm install tz
npm install --dev tz; npm test tz
MIT
FAQs
sniff for timezone info using pure JS
The npm package tz receives a total of 660 weekly downloads. As such, tz popularity was classified as not popular.
We found that tz 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.