
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing
The tr46 npm package is a JavaScript implementation of the TR46 algorithm, which is used for processing internationalized domain names (IDNs) and internationalized email addresses. It provides functionality to convert Unicode strings to ASCII strings that conform to the IDNA (Internationalized Domain Names in Applications) standards, and vice versa. This is useful for applications that need to handle domain names containing non-ASCII characters.
toASCII
Converts a Unicode domain name to an ASCII Compatible Encoding (ACE), following the IDNA standards. This is useful for domain name resolution in environments that only support ASCII.
const tr46 = require('tr46');
const result = tr46.toASCII('täst.com');
console.log(result); // 'xn--tst-qla.com'
toUnicode
Converts an ASCII Compatible Encoding (ACE) domain name back to its Unicode form. This is useful for displaying domain names to users in their native script.
const tr46 = require('tr46');
const result = tr46.toUnicode('xn--tst-qla.com');
console.log(result); // 'täst.com'
processing options
Provides additional processing options for toASCII and toUnicode functions, such as checking for proper use of hyphens, bidirectional characters, and joiners, as well as using STD3 ASCII rules and choosing between transitional or non-transitional processing.
const tr46 = require('tr46');
const result = tr46.toASCII('täst.com', {checkHyphens: true, checkBidi: true, checkJoiners: true, useSTD3ASCIIRules: true, processingOption: 'TRANSITIONAL'});
console.log(result); // 'xn--tst-qla.com'
Punycode.js is a robust Punycode converter that fully complies with RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms. This package is used to convert Unicode strings to Punycode and vice versa, similar to tr46's toASCII and toUnicode functions. However, tr46 provides additional processing options and is designed to comply with the TR46 algorithm.
The idna-uts46 package is a small library that converts a Unicode string to an ASCII string as per the IDNA2008 (UTS #46) standard. It is similar to tr46 in that it handles internationalized domain names, but it may have different API options and compliance specifics.
An JavaScript implementation of Unicode Technical Standard #46: Unicode IDNA Compatibility Processing.
toASCII(domainName[, options])
Converts a string of Unicode symbols to a case-folded Punycode string of ASCII symbols.
Available options:
checkBidi
checkHyphens
checkJoiners
ignoreInvalidPunycode
transitionalProcessing
useSTD3ASCIIRules
verifyDNSLength
toUnicode(domainName[, options])
Converts a case-folded Punycode string of ASCII symbols to a string of Unicode symbols.
Available options:
checkBidi
Type: boolean
Default value: false
When set to true
, any bi-directional text within the input will be checked for validation.
checkHyphens
Type: boolean
Default value: false
When set to true
, the positions of any hyphen characters within the input will be checked for validation.
checkJoiners
Type: boolean
Default value: false
When set to true
, any word joiner characters within the input will be checked for validation.
ignoreInvalidPunycode
Type: boolean
Default value: false
When set to true
, invalid Punycode strings within the input will be allowed.
transitionalProcessing
Type: boolean
Default value: false
When set to true
, uses transitional (compatibility) processing of the deviation characters.
useSTD3ASCIIRules
Type: boolean
Default value: false
When set to true
, input will be validated according to STD3 Rules.
verifyDNSLength
Type: boolean
Default value: false
When set to true
, the length of each DNS label within the input will be checked for validation.
FAQs
An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing
The npm package tr46 receives a total of 61,948,465 weekly downloads. As such, tr46 popularity was classified as popular.
We found that tr46 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.