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.
api-mock-objects
Advanced tools
This repository will hold the happy-path input objects for eaze api endpoints. Each endpoint will have its own json file of working input params that can be pulled in by the index.js service or cli. Pass it the path and request-type of an endpoint and it
This repository will hold the happy-path input objects for eaze api endpoints. Each endpoint will have its own json file of working input params that can be pulled in by the index.js service or cli. Pass it the path and request-type of an endpoint and it will return an object of path, query and body/post parameters (by command line passing "RUN_ENDPOINT" will also return the response). For endpoints that require data from other endpoints, a "parent" can be assigned, to chain requests together. Wrap any variable-name/key in brackets and the path/request-type of the parent endpoint, and the script will pull values from that endpoint's parent endpoint. For instance, to place an item in a cart, the parent endpoint might be a create-cart endpoint, which also has a parent of a logged-in user; so it would execute that request before generating the mock data necessary to add an item into a cart.
npm install --save-dev https://github.com/eaze/api-mock-objects.git
const mock = require('api-mock-objects')
mock('auth/signin', 'post').then(function (mockData) {
console.log(mockData)
})
# Return a sign-in happy-path object, that can be used directly in api-request functions
GETMOCK_ENDPOINT="auth/signin" GETMOCK_TYPE="post" DEUBG_LEVEL=INFO node index.js
# Return a sign-in happy-path object, and return the response from api-request
RUN_ENDPOINT=TRUE GETMOCK_ENDPOINT="auth/signin" GETMOCK_TYPE="post" DEUBG_LEVEL=INFO node index.js
# Get Location (requires zipCode and xAuthToken from get-user endpoint response)
{
"headers": {
"X-Auth-Token": "{xAuthToken}"
},
"parent": {
"path": "users/{user}/basic",
"requestType": "get"
},
"path": {},
"query": {
"query": "{zipCode}"
},
"body": {}
}
# Get User (requires userId and xAuthToken from sign-in endpoint response)
{
"headers": {
"X-Auth-Token": "{xAuthToken}"
},
"parent": {
"path": "auth/signin",
"requestType": "post"
},
"path": {
"user": "{userId}"
},
"query": {},
"body": {}
}
# Sign In
{
"headers": {},
"parent": {},
"path": {},
"query": {},
"body": {
"email": "email@eaze.com",
"password": "password"
}
}
Generate a hierarchical graph of the parent/child relationship of each endpoint. https://bl.ocks.org/mbostock/4063550
There could be a "cleanup" parameter that could indicate an endpoint necessary to remove anything created in the process of creating the mock data. Those endpoints could be held back until all tests are run.
The generated api-request test should be run hierarchically so that no endpoint is tested before it's parent is tested.
The mock-data test could iterate through each mock object using JOI to verify the successful responses and handle error/edge cases.
It would be nice to add the concept of randomizing a parameter to handle those endpoints (with no parents) that cannot be run multiple times with the same data, like /auth/signup.
const num = (() => {
let num = Math.round(Math.random() * 10000000)
return 555${Date.now().toString().substr(-7)}
})()
FAQs
This repository will hold the happy-path input objects for eaze api endpoints. Each endpoint will have its own json file of working input params that can be pulled in by the index.js service or cli. Pass it the path and request-type of an endpoint and it
The npm package api-mock-objects receives a total of 0 weekly downloads. As such, api-mock-objects popularity was classified as not popular.
We found that api-mock-objects 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.