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.
@fractal-components/random-gif-pair
Advanced tools
A sample UI component built using `fractal-component`
This is a sample UI Component built by re-using two RandomGif components. Its internal structure is simply as below:
<div className={classes.table}>
<div className={classes.cell}>RandomGif Pair</div>
<div className={`${classes.cell}`}>
<div>
<RandomGif
showButton={false}
apiKey={this.props.apiKey}
namespacePrefix={`${
this.componentManager.fullPath
}/Gifs`}
/>
</div>
<div>
<RandomGif
showButton={false}
apiKey={this.props.apiKey}
namespacePrefix={`${
this.componentManager.fullPath
}/Gifs`}
/>
</div>
</div>
{this.props.showButton && (
<div className={`${classes.cell} `}>
<button
onClick={() => {
this.componentManager.dispatch(
actions.requestNewPair()
);
}}
disabled={this.state.isLoading}
>
{this.state.isLoading
? "Loading..."
: "Get Gif Pair"}
</button>
</div>
)}
{/**
* Use ActionForwarder to throw NEW_GIF out of RandomGifPair container
* Set namespace to `${this.componentManager.fullPath}/Gifs` in order to listen to
* all `out of box` actions from two `RandomGif` components
*/}
<ActionForwarder
namespacePrefix={`${this.componentManager.fullPath}/Gifs`}
pattern={RandomGifActionTypes.NEW_GIF}
relativeDispatchPath="../../../../*"
/>
{/**
* Use ActionForwarder to forward LOADING_START & LOADING_COMPLETE actions from `RandomGif`
* to current component (`RandomGifPair`)'s namespace.
* i.e. from `${this.componentManager.fullPath}/Gifs` to `${this.componentManager.fullPath}`
* Thus, `relativeDispatchPath` should be ".."
*/}
<ActionForwarder
namespacePrefix={`${this.componentManager.fullPath}/Gifs`}
pattern={action =>
action.type === RandomGifActionTypes.LOADING_START ||
action.type === RandomGifActionTypes.LOADING_COMPLETE
}
relativeDispatchPath=".."
/>
</div>
To try it out, simply create a HTML file with the following content (also available on CodePen):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RandomGifPair Demo</title>
<!--
Load `babel-standalone` to support JSX in script tag
-->
<script src="https://unpkg.com/babel-standalone@^7.0.0/babel.min.js"></script>
<script src="https://unpkg.com/react@~16.8.0/umd/react.production.min.js"></script>
<script src="https://unpkg.com/prop-types@~15.6.2/prop-types.min.js"></script>
<script src="https://unpkg.com/react-dom@~16.8.0/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/redux-saga@~1.0.0/dist/redux-saga.min.umd.js"></script>
<script src="https://unpkg.com/fractal-component@latest/dist/fractal-component.min.umd.js"></script>
<script src="https://unpkg.com/jss@9.8.7/dist/jss.min.js"></script>
<script src="https://unpkg.com/jss-preset-default@4.5.0/dist/jss-preset-default.min.js"></script>
<script src="https://unpkg.com/@fractal-components/random-gif@latest/dist/@fractal-components/random-gif.min.umd.js"></script>
<script src="https://unpkg.com/@fractal-components/random-gif-pair@latest/dist/@fractal-components/random-gif-pair.umd.js"></script>
</head>
<body>
<div id="app_root"></div>
<script type="text/babel">
const appContainer = new FractalComponent.AppContainer({
reduxDevToolsDevOnly: false
});
ReactDOM.render(
<FractalComponent.AppContainerContext.Provider
value={appContainer}
>
<RandomGifPair.default />
</FractalComponent.AppContainerContext.Provider>,
document.getElementById("app_root")
);
</script>
</body>
</html>
You can also use it as ES6 module:
import "@babel/polyfill";
import React from "react";
import ReactDOM from "react-dom";
import { AppContainer, AppContainerContext } from "fractal-component";
import RandomGifPair, { actions, actionTypes } from "@fractal-components/random-gif-pair";
const appContainer = new AppContainer({
reduxDevToolsDevOnly: false
});
ReactDOM.render(
<AppContainerContext.Provider value={appContainer}>
<RandomGifPair />
</AppContainerContext.Provider>,
document.getElementById("root")
);
RandomGifPairPair
This comes with a testing Giphy.com API key in order to retrieve random Gifs from https://giphy.com/. The api key is limted to 40 requests per hour.
You can create your own API key from https://developers.giphy.com/ and set the API key by api
property. e.g.
<RandomPair apiKey="xxxxxxxx" />
FAQs
A sample UI component built using `fractal-component`
The npm package @fractal-components/random-gif-pair receives a total of 11 weekly downloads. As such, @fractal-components/random-gif-pair popularity was classified as not popular.
We found that @fractal-components/random-gif-pair 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
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.