
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@ckpack/fetch-helper
Advanced tools
fetch-helper
is a lightweight wrapper for the fetch API, only supported in browsers, if needed For use in node environment, please add fetch-node
global dependency.
import fetch from 'node-fetch';
globalThis.fetch = fetch;
If you are using a node version greater than
v17.5.0
, you can enable thefetch
API directly with the --experimental-fetch CLI flag
Promise fetchHelper(input[, init]);
input
: the requested url or Request
objectinit
: a configuration item object, including all the settings for the request, except all the configuration items that support native fetch Parameters also added the following parameters
interceptors
: request interceptors, this parameter contains two attributes
request
: contains an array of type (init, ctx) => init
, triggered before the request is triggered, you can modify the request parameters by returning a new configuration item objectresponse
: contains an array of type (response, ctx) => response
, triggered after the request is triggered, you can use it to modify the returned response
ctx
is the context of the current request instance, through which you can get or modify the current request'sinput
,init
and other instance parameters
A Response
[Response
](https://developer.mozilla.org/ en-US/docs/Web/API/Response) object.
You can use the create
method to create an instance with a default config object
fetchHelper.create({
method: 'GET',
mode: 'cors',
interceptors: {
response: [(response, config) => {
return response.json();
}]
}
});
fetchInstance(`some url`);
header
fetchHelper(`some url`, {
interceptors: {
request: [(config) => {
config.headers = new Headers({
'Authorization': localStorage.getItem('token')
});
return config;
}],
}
});
json
fetchHelper(`some url`, {
interceptors: {
response: [(response) => {
return response.json();
}]
}
});
timeout
const fetchInstance = fetchHelper.create({
interceptors: {
request: [(config)=>{
if(config.timeout){
const controller = new AbortController();
config.signal = controller.signal;
setTimeout(()=> {controller.abort()}, config.timeout)
}
return config;
}],
}
});
fetchInstance('some url', {
timeout: 6000,
});
baseURL
const fetchInstance = fetchHelper.create({
baseURL: 'http://some.url',
interceptors: {
request: [(config, ctx)=>{
ctx.input = `${config.baseURL}${ctx.input}`;
return config;
}],
}
});
fetchInstance('/sub-url');
FAQs
The npm package @ckpack/fetch-helper receives a total of 0 weekly downloads. As such, @ckpack/fetch-helper popularity was classified as not popular.
We found that @ckpack/fetch-helper 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.