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.
node-zookeeper - A Node.js client for Apache Zookeeper.
This module is implemented on top of the ZooKeeper C API; consult the ZK Reference for further details on behavior.
var ZooKeeper = require ("zookeeper");
var zk = new ZooKeeper({
connect: "localhost:2181"
,timeout: 200000
,debug_level: ZooKeeper.ZOO_LOG_LEVEL_WARNING
,host_order_deterministic: false
});
zk.connect(function (err) {
if(err) throw err;
console.log ("zk session established, id=%s", zk.client_id);
zk.a_create ("/node.js1", "some value", ZooKeeper.ZOO_SEQUENCE | ZooKeeper.ZOO_EPHEMERAL, function (rc, error, path) {
if (rc != 0) {
console.log ("zk node create result: %d, error: '%s', path=%s", rc, error, path);
} else {
console.log ("created zk node %s", path);
process.nextTick(function () {
zk.close ();
});
}
});
});
_
( path, version, void_cb )
_
is added to avoid conflict with reserved word _delete_
since zk_promise.js strips off prefix a_
from all operations)The watcher methods are forward-looking subscriptions that can recieve multiple callbacks whenever a matching event occurs.
Session state machine is well described in Zookeeper docs, i.e.
Fixes:
TODO:
Data coming out of ZooKeepr (in callbacks) will now default to being Buffer objects. The main ZK handle now has a boolean attribute called 'data_as_buffer', which defaults to true. If you are storing strings only, as was only allowed in the initial implementation, or you wish to have data in callbacks arrive as strings, you add 'data_as_buffer:false' to the init options, or add 'zk.data_as_buffer = false;' before using the handle. The behavior defaults to Buffer objects because this aligns more closely with ZooKeeper itself which uses byte arrays. They are interchangable on input, if the input is a Buffer it will be used directly, otherwise the toString() of the input is used (this will work with utf8 data as well) regardless of mode.
With the new Buffer changes in the 0.3+ and 0.4+ branches, these will be internal 'SlowBuffer' objects, and you should use Buffer.isBuffer if you are checking the type, as 'instanceof Buffer' will return false.
zk_r.on_connected().
then (
function (zkk){
console.log ("reader on_connected: zk=%j", zkk);
return zkk.create ("/node.js2", "some value", ZK.ZOO_SEQUENCE | ZK.ZOO_EPHEMERAL);
}
).then (
function (path) {
zk_r.context.path = path;
console.log ("node created path=%s", path);
return zk_r.w_get (path,
function (type, state, path_w) { // this is a watcher
console.log ("watcher for path %s triggered", path_w);
deferred_watcher_triggered.resolve (path_w);
}
);
}
).then (
function (stat_and_value) { // this is the response from w_get above
console.log ("get node: stat=%j, value=%s", stat_and_value[0], stat_and_value[1]);
deferred_watcher_ready.resolve (zk_r.context.path);
return deferred_watcher_triggered;
}
).then (
function () {
console.log ("zk_reader is finished");
process.nextTick( function () {
zk_r.close ();
});
}
);
node-waf configure build [--zookeeper zookeeper-version|prefix-path|'']
DDOPSON-2011-11-30 - are these issues still relevant? unknown.
See LICENSE-MIT.txt file in the top level folder.
Yuri Finkelstein (yurif2003 at yahoo dot com)
with awesome contributions from:
Woody Anderson (Woodya) Dave Dopson (ddopson) Ryan Phillips (rphillips)
FAQs
apache zookeeper client (zookeeper async API v3.5.x - v3.8.x)
The npm package zookeeper receives a total of 4,578 weekly downloads. As such, zookeeper popularity was classified as popular.
We found that zookeeper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
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.