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.
Utilities for working with common protobuf types.
$ npm i --save pb-util
Encodes a JSON value into a google.protobuf.Value
.
Type: string
number
boolean
null
object
array
const {value} = require('pb-util');
const stringValue = value.encode('hello!');
// => {
// kind: 'stringValue',
// stringValue: 'hello!'
// }
Decodes a google.protobuf.Value
into a JSON value.
Type: google.protobuf.Value
const {value} = require('pb-util');
const str = value.decode({
kind: 'stringValue',
stringValue: 'beep boop'
});
// => 'beep boop'
Encodes a JSON object into a google.protobuf.Struct
.
Type: object
const {struct} = require('pb-util');
const structValue = struct.encode({foo: 'bar'});
// => {
// fields: {
// foo: {
// kind: 'stringValue',
// stringValue: 'bar'
// }
// }
// }
Decodes a google.protobuf.Struct
into a JSON object.
Type: google.protobuf.ListValue
const {struct} = require('pb-util');
const obj = struct.decode({
fields: {
foo: {
kind: 'stringValue',
stringValue: 'bar'
},
yes: {
kind: 'boolValue',
boolValue: true
}
}
});
// => {
// foo: 'bar',
// yes: true
// }
Encodes an array of JSON values into a google.protobuf.ListValue
.
Type: array
const {list} = require('pb-util');
const listValue = list.encode(['foo', 'bar']);
// => {
// values: [
// {
// kind: 'stringValue',
// stringValue: 'foo'
// },
// {
// kind: 'stringValue',
// stringValue: 'bar'
// }
// ]
// }
Decodes a google.protobuf.ListValue
into an array of JSON values.
Type: google.protobuf.ListValue
const {list} = require('pb-util');
const arr = list.decode({
values: [
{
kind: 'stringValue',
stringValue: 'foo'
},
{
kind: 'numberValue',
numberValue: 10
}
]
});
// => ['foo', 10]
ISC
FAQs
Utilities for working with common protobuf types
We found that pb-util 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.