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.
@kasko/fe-mock-api-lib
Advanced tools
KASKO platform API request mocking made easy.
yarn add -D @kasko/fe-mock-api-lib
+ const mockApi = require('@kasko/fe-mock-api-lib');
module.exports = {
mode: 'development',
devServer: {
open: true,
port: 3000,
+ before(app) {
+ mockApi(app, path.resolve('./mock-api/api.js'));
+ },
+
+ // Optional: reload page after changes are made
+ contentBase: [
+ path.resolve('./src'),
+ path.resolve('./mock-api'),
+ ],
+ watchContentBase: true,
},
};
mock-api
folder:mock-api/api.js
const path = require('path');
const mockApi = require('@kasko/fe-mock-api-lib');
const item = require('./resources/item.json');
const itemContents = mockApi.parseCsvFile(path.resolve(__dirname, './resources/item-contents.csv'));
const itemFieldDefinitions = require('./resources/item-field-definitions.json');
const itemManifest = require('./resources/item-webapp-manifest.json');
module.exports = mockApi.constructRoutes({
'GET /touchpoints/:touchpoint/items/:item': async (req, res) => {
item.content.data = await itemContents;
item.webapp_manifest = itemManifest;
item.field_definition = itemFieldDefinitions;
return res.json(item);
},
});
mock-api/resources/item-contents.csv
"hello.world","Hello!"
mock-api/resources/item-field-definitions.json
{
"policy": [
{
"name": "salutation",
"validation": "required|string|in:mr,ms"
}
],
"quote": [
{
"name": "duration",
"validation": "required|string|in:P1Y,P2Y,P3Y"
}
]
}
mock-api/resources/item-webapp-manifest.json
{
"version": "1.0",
"schema": {
"config": {
"initial_screen": "start",
"default_values": {
"duration": "P1Y"
},
"requests": [
{
"type": "quote"
},
{
"type": "policy"
},
{
"type": "payment"
}
],
"content_key": {
"insurer_name": "insurer_name"
}
},
"flow": [
// ...
]
}
}
mock-api/resources/item.json
{
"id": "id_hash",
"object": "item",
"currency": "eur",
"currency_profile_id": "id_hash",
"field_definition": {},
"config": {
"tax_rate": 0.19
},
"webapp_manifest": {},
"tags": [],
"payment_methods": [
{
"payment_method": "creditcard",
"provider": "stripe",
"keys": {
"public_key": "pk_test_123"
}
}
],
"subscription_plans": [],
"content": {
"id": "id_hash",
"object": "content",
"data": {}
},
"assets": []
}
yarn install
yarn test
yarn lint
FAQs
KASKO platform API request mocking made easy.
We found that @kasko/fe-mock-api-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 18 open source maintainers 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.