
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
brake-client
Advanced tools
import BrakeClient from 'brake-client';
import rp from 'request-promise';
const SERVICE_NAME = 'a-service';
const brake = new BrakeClient(SERVICE_NAME);
//set health check.
brake.healthCheck(() => {
return rp({
method: 'get',
url: `/${SERVICE_NAME}/health`,
headers: {
'Content-Type': 'application/json'
}
});
});
brake.on('circuitOpen', () => {
logger.warn(`The service: ${SERVICE_NAME}'s circuit is opened.`);
});
brake.on('circuitClosed', () => {
logger.info(`The service: ${SERVICE_NAME}'s circuit is closed.`);
});
brake.fallback(err => {
throw new Error('Cannot invoke downstream service. please try again soon.', err);
});
export function getResource(id) {
const request = {
method: 'get',
url: `/${SERVICE_NAME}/v1/resources/:id`,
params: {id: id},
headers: {
'Content-Type': 'application/json'
}
};
return brake.circuit({send: rp}).send(request);
}
You can use brake client to invoke resource api. The example is
import resourceClient from './ResourceClient';
resourceClient.getResource(id).then(resource => {
console.log(resource);
})
The service name.
The options param is the same as brakes. We extend it, and support request handlers
Set a callback, when the circuit is open, the callback will be used for checking the service's health status, if the status is ok, the circuit will close.
See brakes for detail.
Return the circuit's status.
FAQs
An client with circuit.
The npm package brake-client receives a total of 3 weekly downloads. As such, brake-client popularity was classified as not popular.
We found that brake-client 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 uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.