Hi @naikrovek,
Thanks for the great discussion here! and thank you for reporting! We take all security concerns very seriously, and I appreciate you taking the time to report your concerns. If you ever see something that you feel is a security issue, please feel free to ping me privately first here on the forums, or email us at hello@particle.io
It looks like the publishEvent function in Spark-JS / Particle-JS is missing the private parameter. You can add this yourself if you want, but I’ll open an issue in the meantime:
/* if you wanted to fix it locally in the meantime */
SparkApi.prototype.publishEvent = function (eventName, data, accessToken, callback) {
this.request({
uri: this.baseUrl + '/v1/devices/events',
method: 'POST',
form: {
name: eventName,
data: data,
access_token: accessToken
//add this line below
,private: true
},
json: true
}, callback);
};
I realize this part may be redundant, but here’s all the info in one place:
In this case, yes, you’re seeing the public event firehose. This is somewhat similar to the “Twitter firehose of public tweets” and other similar streams. Publicly published events appear in the public firehose, and only your accounts private events will appear in your own feeds. The API endpoints also correspond to the various privilege levels:
/v1/events -> public firehose
/v1/events/some_filter -> filtered public firehose
/v1/devices/events -> your events from your devices
/v1/devices/some_device/events -> events from that device
You can prevent your events from showing in the public firehose by publishing them privately. For example:
Spark.publish("front-door-unlocked", PRIVATE);
Spark.publish("front-door-unlocked", "Steve unlocked the door", 60, PRIVATE);
Thanks!
David