
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).
@ditox/react
Advanced tools
React.js tooling for Ditox.js DI container.
Install with npm
npm install ditox @ditox/react --save
Or yarn
yarn add ditox @ditox/react
@ditox/react
is a set of helpers for providing and using a dependency container in React apps:
DepencencyContainer
- provides a new or existed container to React components.DepencencyModule
- binds a dependency module to a new container.CustomDepencencyContainer
- provides an existed dependency container.useDependencyContainer()
- returns a provided dependency container.useDependency()
- returns a resolved value by a specified token. It throws an error in case a container or value is not found.useOptionalDependency()
- returns a resolved value by a specified token, or returns undefined
in case a container or value is not found.Examples:
import {
DependencyContainer,
DependencyModule,
useDependency,
useDependencyContainer,
useOptionalDependency,
} from '@ditox/react';
import {token} from 'ditox';
import {LOGGER_MODULE} from './logger';
const FOO = token();
const BAR = token();
function appDependencyBinder(container) {
container.bindValue(FOO, 'foo');
}
function App() {
return (
<DependencyContainer binder={appDependencyBinder}>
<NestedComponent />
</DependencyContainer>
);
}
function NestedComponent() {
// Get access to the container
const container = useDependencyContainer();
// Use a resolved value
const foo = useDependency(FOO);
// Use an optional value. It is not provided in this example.
const bar = useOptionalDependency(BAR);
useEffect(() => {
console.log({foo, bar}); // {foo: 'foo', bar: undefined}
}, [foo, bar]);
return null;
}
Dependency modules can be provided to the app with <DependencyModule />
component:
function App() {
return (
<DependencyModule module={LOGGER_MODULE}>
<NestedComponent />
</DependencyModule>
);
}
© 2020-2021 Mikhail Nasyrov, MIT license
FAQs
Ditox.js tooling for React.js
The npm package @ditox/react receives a total of 1 weekly downloads. As such, @ditox/react popularity was classified as not popular.
We found that @ditox/react 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.
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.