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.
Binary Term Format
is a term format inspired in ETF with more types and circular reference serialization and deserialization.
This term format is designed to fix one of ETF's flaws: byte size.
Serializing this object:
{
"test": ["hello", "world"],
"more": {
"nested": "objects",
"do": ["you", "like", "it?"]
}
}
Takes 80
bytes as JSON.stringify()
'd, 116
bytes as ETF
using devsnek/earl
, and just 71
bytes in BTF
.
The extreme compression is achieved by delimiting the bytes using a technique similar to null delimited strings. Allowing every string, array, set, map, and object, to trim the byte size by 3 (4 bytes for length/size -> 1 byte to delimit the field). TypedArrays do not get this feature, since they have a type for all elements instead of a type for each element, [0]
works because it is encoded as ArrayType
+ NumberByteLiteralType
+ 0x00
+ NullDelimiter
, but this technique would not work in Uint8Array[0]
(Uint8ArrayType
+ 0x00 + 0x00 + 0x00 + 0x01
+ 0x00
).
And this is also achieved by using special types for empty collections, [null]
takes 3 bytes (ArrayType
+ NullType
+ NullDelimiter
), but []
takes a single byte (EmptyArrayType
). This also applies to empty objects, sets, and maps.
This module is plug-and-play, it exposes two functions, serialize
and deserialize
, and would be used in the following way:
const { serialize, deserialize } = require('binarytf');
const serialized = serialize({ hello: 'world' });
const deserialized = deserialize(serialized);
console.log(deserialized); // { hello: 'world' }
This module is TypeScript ready and comes with types included. To import with ESM use the following syntax:
import { serialize, deserialize } from 'binarytf';
binarytf
is heavily based on devsnek/earl
, this module wouldn't be possible without it's author:
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
binarytf © kyranet, released under the MIT License. Authored and maintained by kyranet.
Please make sure to read the Contributing Guide before making a pull request.
Thank you to all the people who already contributed!
FAQs
Binary Term Format
The npm package binarytf receives a total of 149 weekly downloads. As such, binarytf popularity was classified as not popular.
We found that binarytf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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’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.