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.
noncharacters
Advanced tools
34 non-character code points (labeled <not a character>), that are set aside and guaranteed to never be used for a character. Perfect to use for placeholders or temporary replacements during string transformations.
34 non-character code points (labeled ), that are set aside and guaranteed to never be used for a character. Perfect to use for placeholders or temporary replacements during string transformations.
See the wikipedia article on non-characters. Also, I used regenerate from mathiasbynens to generate the range of characters.
npm i noncharacters --save
var noncharacters = require('noncharacters');
//=> ['\uFFFF', '\uFFFE', ...]
Example
Let's say you need to transform a string but you need to temporarily replace some characters that might cause issues.
Create your own placeholders:
// arbitrary characters we want to replace,
// mapped to placeholder non-characters
var placeholders = {
'{': noncharacters[0],
'}': noncharacters[1]
};
// the string with characters to replace
var str = 'This is a template: {name}';
// actually replace the characters
Object.keys(placeholders).forEach(function(ch) {
str = str.replace(ch, placeholders[ch]);
});
//=> This is a template: \uFFFFname\uFFFE
Now you can do whatever you want to str
. Then, to change back:
Object.keys(placeholders).forEach(function(ch) {
str = str.replace(placeholders[ch], ch);
});
//=> This is a template: {name}
Install dev dependencies:
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on February 27, 2015.
FAQs
34 non-character code points (labeled <not a character>), that are set aside and guaranteed to never be used for a character. Perfect to use for placeholders or temporary replacements during string transformations.
The npm package noncharacters receives a total of 33,914 weekly downloads. As such, noncharacters popularity was classified as popular.
We found that noncharacters 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.