
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
generate-object-property
Advanced tools
Generate safe JS code that can used to reference a object property
The generate-object-property npm package is a utility that helps in generating JavaScript object property access strings. It is particularly useful for creating dynamic property accessors in a safe and efficient manner.
Generate Property Access String
This feature allows you to generate a string that can be used to access a property on an object. It ensures that the property name is safely quoted if necessary.
const generate = require('generate-object-property');
const obj = {};
const prop = 'foo';
const value = 'bar';
const propString = generate(obj, prop);
console.log(propString); // Outputs: obj["foo"]
Dynamic Property Access
This feature demonstrates how you can dynamically set a property on an object using the generated property access string.
const generate = require('generate-object-property');
const obj = {};
const prop = 'foo';
const value = 'bar';
const propString = generate(obj, prop);
eval(propString + ' = value;');
console.log(obj.foo); // Outputs: bar
Lodash is a modern JavaScript utility library delivering modularity, performance, and extras. It provides a wide range of utility functions, including methods for deep property access and manipulation, which can be used similarly to generate-object-property but with more extensive functionality.
Dot-prop is a package that allows you to get, set, or delete a property from a nested object using a dot path. It provides a more straightforward API for accessing and manipulating nested properties compared to generate-object-property.
Object-path is a tiny JavaScript utility to access deep properties using a path string. It offers similar functionality to generate-object-property but focuses more on deep property access and manipulation.
Generate safe JS code that can used to reference a object property
npm install generate-object-property
var gen = require('generate-object-property');
console.log(gen('a','b')); // prints a.b
console.log(gen('a', 'foo-bar')); // prints a["foo-bar"]
MIT
FAQs
Generate safe JS code that can used to reference a object property
The npm package generate-object-property receives a total of 2,027,712 weekly downloads. As such, generate-object-property popularity was classified as popular.
We found that generate-object-property 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.