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.
parse-tester
Advanced tools
#Parse tester
Tool for creating automated tests for parse.com based based backends.
It's based on top of Jasmine, so you can group tests using describe
and assert using expect
.
To launch tests just launch node-jasmine <your-test-dir>
. As in jasmine, only cases in files with their names ending with spec
will be tested.
To make TestCase
constructing function avalilable you have to:
var TestCase = require('parse-tester')(config);
It's created this way for future tests because allow to override ALL of required dependencies. Config format is described below.
Config is simple object as presented below:
var config = {
apiUrl: 'https://api.parse.com/1/functions/',
requestSetup: {
hostname: 'api.parse.com',
port: 443,
method: 'POST',
headers: {
'X-Parse-Session-Token': '<your session token>',
'X-Parse-Application-Id': '<yours application id>',
'X-Parse-REST-API-Key': '<your rest api key>',
'Content-Type': 'application/json'
}
}
};
The simplest test you can write is:
var noItems = new TestCase({
title: 'simple test',
types: [],
data: [],
request: {
functionName: 'getItems',
body: {}
},
assertions: function (response, data, types) {
expect(true).toBe(true);
}
});
Tester will create jasmine suite for given test and launch assertions after each needed request will be received. All given fields are required.
Given object has to be in format as given:
title
- it's the same string which would you use in jasmine's describe
types
- array with string containing names of types of which all objects will be downloaded from parse after making main requestdata
:
type
- name of object's type (it will be used for saving object in proper table)body
- object containing object's dataitems
- array defined as abovelinks
- array containing links (described below)request
- object containing two fields:
functionName
- name of cloud code function which will calledbody
- object with request body (only data)assertions
- function containing all assertions for case. It will receive arguments: response
, data
, types
where:
response
- response object in format compatible with http/https node packagesdata
- object with data items, it's the same (but extended) object which was defined in data
field, it is in format:
items
- array containing defined items, every in format described belowlinks
- array containing linkstypes
- object containing downloaded whole tables as given in types
field. Detailed description is below.After that just call noItems.run()
.
type
- type of given itembody
- item's dataobjectId
- item's id (given by parse). This field is added in preparing data phase before request.actual
- actual item's state. This field is added in downloading data phase after request.It's way for creating connections between objects stored in parse's db.
source
- index of object beeing a source of data for other object
func
- linking function, it will receive object beeing source, can be used for example for preparing requests as given:
var linkedRequest = new TestCase((function () {
var testObj = {
'title': 'linked request test',
types: [],
data: {
items: [
{
type: 'SomeType',
body: {
data: 'foo'
}
}
],
links: [
{
source: 0,
func: linker
}
]
},
request: {
functionName: 'someFunc',
body: null
},
assertions: function (response, data, types) {
expect(true).toBe(true);
}
};
function linker (item) {
testObj.request.body = {
id: item.objectId
};
}
return testObj;
})());
target
- index of linking target
properties
- object containing properties to copy where key is property name in source object, value is string containing property name in target object. If source property is equal objectId
, then will be created pointer to source object
If linking function is present, then target
and properties
are ignored.
It's array containing names of types to download after main request. When data are downloaded, then under key beeing type name is array of objects with given type as they are stored in parse.
FAQs
Tool for creating parse based backend tests
We found that parse-tester 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.