n8n-nodes-kafka-batch-consumer 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -292,23 +292,25 @@ describe('KafkaBatchConsumer', () => {
|
|
|
292
292
|
});
|
|
293
293
|
});
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Test plaintext connection (no SSL)
|
|
297
|
+
* When ssl is false or undefined, no SSL configuration should be added
|
|
298
|
+
*/
|
|
299
|
+
it('should handle plaintext connection without SSL', async () => {
|
|
296
300
|
mockExecuteFunctions.getCredentials.mockResolvedValue({
|
|
297
301
|
brokers: 'localhost:9092',
|
|
298
302
|
clientId: 'test-client',
|
|
299
|
-
ssl: false,
|
|
303
|
+
ssl: false, // Explicitly disable SSL
|
|
300
304
|
});
|
|
301
305
|
|
|
302
|
-
mockConsumer.run.mockImplementation(async () => Promise
|
|
306
|
+
mockConsumer.run.mockImplementation(async () => new Promise(() => {}));
|
|
303
307
|
|
|
304
308
|
await kafkaBatchConsumer.execute.call(mockExecuteFunctions);
|
|
305
309
|
|
|
310
|
+
// Should NOT include ssl config when ssl: false
|
|
306
311
|
expect(Kafka).toHaveBeenCalledWith({
|
|
307
312
|
clientId: 'test-client',
|
|
308
313
|
brokers: ['localhost:9092'],
|
|
309
|
-
ssl: {
|
|
310
|
-
rejectUnauthorized: false,
|
|
311
|
-
},
|
|
312
314
|
});
|
|
313
315
|
});
|
|
314
316
|
|
|
@@ -162,9 +162,10 @@ export class KafkaBatchConsumer implements INodeType {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// Add SSL/TLS configuration for encrypted connections
|
|
165
|
-
if
|
|
165
|
+
// Only enable SSL if explicitly set to true or if SSL certificates are provided
|
|
166
|
+
if (credentials.ssl === true || credentials.ca || credentials.cert || credentials.key) {
|
|
166
167
|
kafkaConfig.ssl = {
|
|
167
|
-
rejectUnauthorized: credentials.ssl, //
|
|
168
|
+
rejectUnauthorized: credentials.ssl !== false, // Default to true if SSL is enabled
|
|
168
169
|
};
|
|
169
170
|
|
|
170
171
|
// Add optional SSL certificates for mutual TLS authentication
|