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.
protobuf-fieldmask
Advanced tools
Library for generating and applying protobuf FieldMask
/**
* Generates field mask that includes all non-function own properties on specified object
* @param {*} object - object to generate field mask from
* @returns {string[]} - generated field mask
*/
function generateFieldMask(object)
The name of the properties containing .
or \
characters are escaped.
For an example, running this function with this input:
{
f: {
a: 22,
b: {
d: 1
},
'b.d': 33,
'x\\y': 44
}
}
generates this output:
['f.a', 'f.b.d', 'f.b\\.d', "f.x\\\\y"]
/**
* Creates a new object that copies fields present in field mask from specified source object
* @param {*} sourceObject - object to apply field mask to
* @param {string[]} fieldMask
* @returns {*} - new object created by applying field mask on source object or original entity if source is not an object
*/
function applyFieldMask(sourceObject, fieldMask)
Respects the escaping of the property names in the fieldMask
.
For an example, running this function with this input:
{
f: {
a: 22,
b: {
d: 1,
x: 2
},
'b.d': 33,
y: 13
},
z: 8
},
['f.a', 'f.b.d', 'f.b\\.d']
generates this output:
{
f: {
a: 22,
b: {
d: 1
},
'b.d': 33
}
}
Special thanks to Jorge Yero Salazar for providing TS typings!
FAQs
Library for generating and applying FieldMask
The npm package protobuf-fieldmask receives a total of 4,196 weekly downloads. As such, protobuf-fieldmask popularity was classified as popular.
We found that protobuf-fieldmask demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
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.