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.
wtf-8 is a well-tested WTF-8 encoder/decoder written in JavaScript. WTF-8 is a superset of UTF-8: it can encode/decode any given Unicode code point, including those of (unpaired) surrogates. Here’s an online demo.
Feel free to fork if you see possible improvements!
Via npm:
npm install wtf-8
Via Bower:
bower install wtf-8
Via Component:
component install mathiasbynens/wtf-8
In a browser:
<script src="wtf-8.js"></script>
In Narwhal, Node.js, and RingoJS ≥ v0.8.0:
var wtf8 = require('wtf-8');
In Rhino:
load('wtf-8.js');
Using an AMD loader like RequireJS:
require(
{
'paths': {
'wtf-8': 'path/to/wtf-8'
}
},
['wtf-8'],
function(wtf8) {
console.log(wtf8);
}
);
wtf8.encode(string)
Encodes any given JavaScript string (string
) as WTF-8, and returns the WTF-8-encoded version of the string.
// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9
wtf8.encode('\xA9');
// → '\xC2\xA9'
// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001
wtf8.encode('\uD800\uDC01');
// → '\xF0\x90\x80\x81'
wtf8.decode(byteString)
Decodes any given WTF-8-encoded string (byteString
) as WTF-8, and returns the WTF-8-decoded version of the string. It throws an error when malformed WTF-8 is detected.
wtf8.decode('\xC2\xA9');
// → '\xA9'
wtf8.decode('\xF0\x90\x80\x81');
// → '\uD800\uDC01'
// → U+10001 LINEAR B SYLLABLE B038 E
wtf8.version
A string representing the semantic version number.
wtf-8 has been tested in (at least) the latest versions of Chrome, Opera, Firefox, Safari, IE, Node.js, Narwhal, RingoJS, PhantomJS, and Rhino.
Mathias Bynens |
wtf-8 is available under the MIT license.
FAQs
A well-tested WTF-8 encoder/decoder written in JavaScript.
The npm package wtf-8 receives a total of 154,374 weekly downloads. As such, wtf-8 popularity was classified as popular.
We found that wtf-8 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.
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.