Skip to content

Commit 1bfbf18

Browse files
committed
Upgraded dependencies to address security vulnerabilities
1 parent ddd3dda commit 1bfbf18

30 files changed

Lines changed: 808 additions & 194 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# BotKit
22

3-
Kore Bot Server SDK is set of libraries which gives you more control over the bots you build on Kore Bots platform. Once you build the Dialog task using Dialog Editor, you can subscribe to all the message and webhook events. You can easily add event handlers in the SDK and get the handle over the messages and webhook events. The SDK requires node.js (version 10 or above) to communicate between your server and the Kore.ai Bots Platform.
3+
Kore Bot Server SDK is set of libraries which gives you more control over the bots you build on Kore Bots platform. Once you build the Dialog task using Dialog Editor, you can subscribe to all the message and webhook events. You can easily add event handlers in the SDK and get the handle over the messages and webhook events. The SDK requires node.js (version 12 or above) to communicate between your server and the Kore.ai Bots Platform.
44

55
Visit https://developer.kore.ai/docs/bots/sdks/using-the-botkit-sdk/ for configuration instructions and API documentation.

app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
require('./util').checkNodeVersion();
2+
var sdk = require("./lib/sdk");
13
var Application = require("./lib/app");
24
var Server = require("./lib/server");
3-
var sdk = require("./lib/sdk");
45
var config = require("./config");
56

67
var app = new Application(null, config);
78
var server = new Server(config, app);
89

9-
sdk.checkNodeVersion();
10-
1110
server.start();
1211

1312
sdk.registerBot(require('./FindAFlight.js'));

config.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
},
55
"app": {
66
"apiPrefix" : "",
7-
"url": "https://0ddf-122-174-183-138.ngrok-free.app"
7+
"url": "http://localhost"
88
},
99
"validations": {
10-
"leastNodeVersion": 10
10+
"leastNodeVersion": 12
1111
},
1212
"credentials": {
13-
"apikey": "tz4fhIiIPg6c1JHnP7tiZBtGfeCtCydlv6rbc6k4acw=",
14-
"appId": "cs-9a909c58-c5a9-569d-aa7c-1f36f94b23ad",
13+
"apikey": "test_api_key",
14+
"appId": "test_app_id",
1515
"st-67890":{
1616
"apikey": "test_api_key2",
1717
"appId": "test_app_id2"
@@ -28,7 +28,8 @@
2828
"redis": {
2929
"options": {
3030
"host": "localhost",
31-
"port": 6379
31+
"port": 6379,
32+
"legacyMode": true
3233
},
3334
"available": false
3435
},

lib/RedisClient.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,40 @@ function createClient (opts, cache_key) {
3434

3535
//use version of redis library passed by caller if provided
3636
opts.redis = opts.redis || redis;
37-
37+
/*
3838
var client = opts.redis.createClient(
3939
opts.options.port,
4040
opts.options.host,
4141
opts.options);
4242
4343
//if errors like connection reset should not cause crash,
4444
client.on('error', errorlistener);
45+
*/
46+
function getRedisConnectionString(redisCong) {
47+
let connectionString = "redis://";
48+
if (redisCong?.user && redisCong?.password) {
49+
connectionString += redisCong?.user + ":" + redisCong?.password + "@";
50+
}
51+
connectionString += (redisCong?.host || "localhost") + ":";
52+
connectionString += redisCong?.port || "6379";
53+
return connectionString;
54+
}
55+
let url = getRedisConnectionString(opts.options);
56+
const client = opts.redis.createClient({
57+
url,
58+
legacyMode: opts.options.legacyMode ?? true
59+
});
60+
4561

62+
client.connect((err) => {
63+
if (err) {
64+
errorlistener(err)
65+
console.error('Error connecting to Redis:', err);
66+
} else {
67+
// Now you can execute Redis commands
68+
}
69+
});
70+
4671
if (typeof cache_key === 'string' && (redis_client_cache[cache_key] === undefined)) {
4772
debug('caching redis client %s', cache_key);
4873
redis_client_cache[cache_key] = client;

lib/sdk/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,6 @@ module.exports = {
247247
return clearConversationSession(request)
248248
.nodeify(callback);
249249
},
250-
checkNodeVersion : function(){
251-
var clientNodeVersion = process.version.match(/^v(\d+\.\d+)/)[1];
252-
if(clientNodeVersion < _.get(config, "validations.leastNodeVersion", 10)){
253-
console.error("The BotKit SDK cannot be initiated. Please use the Node.js version 10.x or above.")
254-
process.exit(78);
255-
}
256-
return;
257-
},
258250
closeConversationSession : function(request, callback) {
259251
if (!request.clearConversationSessionUrl) {
260252
throw new errors.InvalidArguments('close conversation session url is missing');

node_modules/.package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)