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.
create-duck
Advanced tools
CLI script for creating Redux ducks. Uses redux-logic middleware and reselect (optionally).
Generates duck file, which can be modified/extended with extra types/actions/logic.
Created for personal needs to avoid writing boilerplate code over and over.
Install NPM package globally:
npm i -g create-duck
Run create-duck
command. You will be prompted to enter:
:warning: Remember to import reducer/logic from duck and add them to root reducer/logic.
Running create-duck
command and entering user-data
as duck name will generate in current working directory user-data.js
file with following content:
import { createLogic } from 'redux-logic';
export const name = 'default';
const prefix = `${name}/`;
/*
* TYPES
*/
const FETCH_DEFAULT = `${prefix}FETCH_DEFAULT`;
const FETCH_DEFAULT_SUCCESS = `${prefix}FETCH_DEFAULT_SUCCESS`;
const FETCH_DEFAULT_CANCEL = `${prefix}FETCH_DEFAULT_CANCEL`;
export const types = {
FETCH_DEFAULT,
FETCH_DEFAULT_SUCCESS,
FETCH_DEFAULT_CANCEL,
};
/*
* ACTIONS
*/
const fetchDefault = options => ({
type: FETCH_DEFAULT,
payload: {
url: 'default',
method: 'post',
...options,
},
});
const fetchDefaultSuccess = data => ({
type: FETCH_DEFAULT_SUCCESS,
data,
});
const fetchDefaultCancel = () => ({
type: FETCH_DEFAULT_CANCEL,
});
export const actions = {
fetchDefault,
fetchDefaultSuccess,
fetchDefaultCancel,
};
/*
* SELECTORS
*/
const getState = state => state[name];
const getDefault = state => getState(state);
export const selectors = {
getState,
getDefault,
};
/*
* LOGIC
*/
const fetchDefaultLogic = createLogic({
type: FETCH_DEFAULT,
cancelType: [FETCH_DEFAULT_CANCEL],
latest: true,
process({ action: { payload }, httpClient, cancelled$ }) {
return httpClient.cancellable(payload, cancelled$)
.then(({ data }) => fetchDefaultSuccess(data));
},
});
export const logic = {
fetchDefaultLogic,
};
/*
* REDUCER
*/
const initialState = {};
const reducer = (state = initialState, action) => {
switch (action.type) {
case FETCH_DEFAULT_SUCCESS:
return {
...action.data
};
default:
return state;
}
};
export default reducer;
FAQs
CLI script for creating Redux ducks
We found that create-duck 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.