Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
An easy way to anonymize your json. This utility can remove all field names from javascript objects.
Let's say you have to put a dataset on your website for your own use, but don't really want to share it to everyone. If you upload the raw, nice dataset with all the field names, people can just take it for their own use easily. You want to make it a bit harder for them to interpret the data without shooting yourself in the foot.
This anonymizer was built for that purpose:
The library is also very lightweight (raw 3KB, minified 1KB) and supports CommonJS, AMD (RequireJS) as well as browser use.
Install with npm:
npm install --save anonymizer
or bower
bower install --save anonymizer
var anonymizer = new Anonymizer();
anonymizer.encode(
{a: 1, b: true, c: 'test'},
{a: 'Number', b: 'Boolean', c: 'String'}
);
=> [1, true, 'test']
anonymizer.encode(
[{a: 1, b: true, c: 'test'}, {a: 2, b: false, c: 'test2'}],
[{a: 'Number', b: 'Boolean', c: 'String'}]
);
=> [ [1, true, 'test'], [2, false, 'test2'] ]
anonymizer.decode(
[1, true, 'test'],
{a: 'Number', b: 'Boolean', c: 'String'}
);
=> {a: 1, b: true, c: 'test'}
anonymizer.decode(
[ [1, true, 'test'], [2, false, 'test2'] ],
[{a: 'Number', b: 'Boolean', c: 'String'}]
);
=> [{a: 1, b: true, c: 'test'}, {a: 2, b: false, c: 'test2'}]
Anonymizer can map categorical values to/from integers.
anonymizer.encode('test', 'Category');
=> 1
anonymizer.encode(['test', 'test2', 'test'], ['Category']);
=> [1, 2, 1]
anonymizer.getCategories();
=> ['test', 'test2']
// Create a new anonymizer and pass known categories
var anonymizer2 = new Anonymizer(anonymizer.getCategories());
anonymizer2.decode(1);
=> 'test'
anonymizer2.decode([1, 2, 1]);
=> ['test', 'test2', 'test']
Primitive values Use string
2
=> schema = 'Number'
'test value'
=> 'String'
true
=> schema = 'Boolean'
Categorical values Use string "Categorical"
'category1'
=> schema = 'Categorical'
Object Use curly braces and contain all the keys that you want to export. The value for each key is the type for that field.
{a: 1, b:'test', c: true}
=> schema = {a: 'Number', b: 'String', c: 'Boolean'}
Array Use square brackets and contains the type of an element. This library assume that all children of an array are of the same type, so you will define the schema for the child only once.
[1, 2, 3]
=> schema = ['Number']
['test1', 'test2']
=> schema = ['String']
['category1', 'category2']
=> schema = ['Category']
Nesting You can combine the syntax above to define any schema for you data.
Array of objects
[
{a: 1, b: true, c: 'test'},
{a: 2, b: false, c: 'test2'}
]
=> schema = [{a: 'Number', b: 'Boolean', c: 'String'}]
Array of arrays
[
[1, 2, 3],
['a', 'b', 'c']
]
=> schema = [['Number'], ['String']]
Object that contains an array
{
a: [1, 2, 3],
b: ['a','b','c'],
c: 'test'
}
=> schema = {a: ['Number'], b: ['String'], c: 'String'}
From the repo root:
npm install
npm test
FAQs
An easy way to anonymize your json. This utility can remove all field names from javascript objects.
The npm package anonymizer receives a total of 0 weekly downloads. As such, anonymizer popularity was classified as not popular.
We found that anonymizer 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.