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.
redux-script-loader
Advanced tools
A simple example:
import { RSL_LOAD } from 'redux-script-loader';
dispatch({
type: RSL_LOAD,
payload: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js',
success: 'LOAD_SUCCESS',
fail: 'LOAD_FAIL',
});
To install from npm:
$ npm install --save redux-script-loader
Then to configure with your redux store:
import { createStore, applyMiddleware } from 'redux';
import { loaderMiddleware } from 'redux-script-loader';
import reducer from './reducers';
const store = createStore(reducer, applyMiddleware(loaderMiddleware(document)));
RSL_LOAD
:: Symbol
A symbol indicating that the action should be handled by the redux-script-loader
middleware.
loaderMiddleware
:: Function
Returns a redux-compatible middleware. Must be initialised with the document
object.
action.type
:: Symbol
Must be RSL_LOAD
imported from the redux-script-loader
package.
action.payload
:: String
The URL from which to load the script. Will be used as the src
attribute of the script
tag.
action.append
:: String | FSA
Action to dispatch when appending the script tag to the document. Can either be a string, or a Flux standard action.
action.success
:: String | FSA
Action to dispatch when the appended script tag finishes loading. Equivalent to the load
event on the script
element.
action.fail
:: String | FSA
Action to dispatch when the appended script tag fails to load. Equivalent to the error
event on the script
element.
FAQs
Redux middleware to load scripts dynamically onto the document
We found that redux-script-loader 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.