Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@avital/meteor-down
Advanced tools
MeteorDown is a load testing tool for Meteor server side components. It uses the DDP protocol to communicate with the Meteor application. You can write your load test in JavaScript and let MeteorDown to invoke it.
Create a file called my_load_test.js
with the following content:
var meteorDown = require('@avital/meteor-down');
meteorDown.init(function (Meteor) {
Meteor.call('example-method', function (error, result) {
Meteor.kill();
});
});
meteorDown.run({
concurrency: 10,
url: "http://localhost:3000"
});
Then run your script:
node my_load_test.js
With the MeteorDown script, you can call methods and invoke subscriptions. The function given to meteorDown.init
will receive the ddp client as the first argument.
This ddp client is based on node-ddp-client but with some changes to make it more Meteor like. Let's look at APIs:
###Meteor.call
Meteor.call('name'[, args*], callback)
Call a Meteor method. Just like the browser client, the callback will receive 2 arguments Error and the Result.
###Meteor.subscribe
Meteor.subscribe('name'[, args*], callback)
The callback function will be called when the subscription is ready and all initial data is loaded to the client.
###Meteor.kill
Meteor.kill()
Disconnect the current client from the server. As soon as this is called, another client will connect to the server and run load test code.
###Meteor.collections
var Collection = Meteor.collections['name']
A dictionary of all client side collections. Data received from subscriptions will be available here.
Normally, most of the Meteor methods and subscriptions are only available for loggedIn users. So, we can't directly invoke those methods and subscriptions. MeteorDown has a solution for that.
First you need to install the following package:
meteor add meteorhacks:meteor-down
Then you need to start your Meteor app with a key. That could be anything you like. But it's better to have a hard to guess key.
export METEOR_DOWN_KEY='YOUR_SUPER_SECRET_KEY'
meteor
Now, add that key to your MeteorDown script and tell which users you need to authenticated against the load test. This is how you can do it.
meteorDown.run({
concurrency: 10,
url: "http://localhost:3000",
key: 'YOUR_SUPER_SECRET_KEY',
auth: {userIds: ['JydhwL4cCRWvt3TiY', 'bg9MZZwFSf8EsFJM4']}
})
Then all your method calls and subscriptions will be authenticated for one of the user mentioned above.
You can also get the loggedIn user's userId by invoking Meteor.userId()
as shown below:
meteorDown.init(function (Meteor) {
console.log("userId is:", Meteor.userId());
})
All test options are optional therefor it's perfectly okay to call mdown.run
without any arguments. All available arguments and their default values are given below.
meteorDown.run({
concurrency: 10,
url: 'http://localhost:3000',
key: undefined,
auth: undefined
});
The maximum number of clients connects to the application at any given time. The real number of concurrent connections can be lower than this number.
Meteor application url. NOTE: This should only have the domain and the port (example: localhost:3000). Meteor-down does not support routes at the moment.
The secret key to use for MeteorDown authentication.
Authentication information. Currently MeteorDown only supports login by userId.
// Meteor Application
Meteor.methods({
add: function (x, y) {return x + y }
})
// MeteorDown Script
meteorDown.init(function (Meteor) {
Meteor.call('add', 5, 6, function (err, res) {
console.log('5 + 6 is ' + res);
Meteor.kill();
});
})
// Meteor Application
Items = new Meteor.Collection('items');
Meteor.publish({
allitems: function () { return Items.find() }
})
// MeteorDown Script
meteorDown.init(function (Meteor) {
Meteor.subscribe('allitems', function () {
console.log('Subscription is ready');
console.log(Meteor.collections.items);
Meteor.kill();
});
})
FAQs
Load testing for Meteor
The npm package @avital/meteor-down receives a total of 1 weekly downloads. As such, @avital/meteor-down popularity was classified as not popular.
We found that @avital/meteor-down 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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.