
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).
A react component for canvas. Mainly for handling resize events to allow auto-maintaince on pixel size and ratio to prevent stretching.
Method | Parameters | Description |
---|---|---|
getCanvasElement | retrieve the canvas react component. | |
getContext | get the context of the canvas. | |
getImageData | startX : integer. Default: 0 startY : integer. Default: 0 endX : integer. Default: the canvas widthendY : integer. Default: the canvas height | get the image data of the canvas with a give area. |
Prop | Description |
---|---|
maintainPixelSize (optional) | whether the canvas should keep dimension from the moment it was created. Default: true |
onResize (optional) | event handler when the canvas is being resized. |
contextType (optional) | canvas context type. Default: "2d" |
import React, { Component } from "react";
import ReactDOM from "react-dom";
import Canvas from "jw-canvas";
class Example extends Component {
constructor(props) {
super(props);
this.resizeHandler = this.resizeHandler.bind(this);
}
draw() {
const canvas = this.myCanvas;
/** Retrieve the HTML element of the canvas. */
const element = canvas.getCanvasElement();
/** Get the width and height of the canvas. */
const { width, height } = element;
/** Get the context of the canvas. */
const context = canvas.getContext();
/** Get the image data of the canvas with a give area. */
const imageData = canvas.getImageData(startX, startY, endX, endY);
/** ... **/
}
resizeHandler(width, height) {
/** ... **/
}
render() {
return (
<Canvas
ref={myCanvas => (this.myCanvas = myCanvas)}
onResize={this.resizeHandler}
maintainPixelSize={false}
contextType="2d"
/>
);
}
}
ReactDOM.render(<Example />, document.getElementById("root"));
FAQs
A react component for canvas.
We found that jw-canvas 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.