Skip to content

Commit c6ae929

Browse files
committed
Properly handle multiple trusted certs
Fixes #105
1 parent fab6d7c commit c6ae929

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/v1/internal/ch-node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const TrustStrategy = {
116116
}
117117

118118
let tlsOpts = {
119-
ca: opts.trustedCertificates.map(fs.readFileSync),
119+
ca: opts.trustedCertificates.map((f) => fs.readFileSync(f)),
120120
// Because we manually check for this in the connect callback, to give
121121
// a more helpful error to the user
122122
rejectUnauthorized: false

test/internal/tls.test.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var fs = require("fs");
2222
var path = require('path');
2323
var hasFeature = require("../../lib/v1/internal/features");
2424

25-
describe('trust-signed-certificates', function() {
25+
fdescribe('trust-signed-certificates', function() {
2626

2727
var driver;
2828

@@ -65,6 +65,24 @@ describe('trust-signed-certificates', function() {
6565
driver.session().run( "RETURN 1").then( done );
6666
});
6767

68+
it('should handle multiple certificates', function(done) {
69+
// Assuming we only run this test on NodeJS with TOFU support
70+
if( !NodeChannel.available ) {
71+
done();
72+
return;
73+
}
74+
75+
// Given
76+
driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"), {
77+
encrypted: true,
78+
trust: "TRUST_SIGNED_CERTIFICATES",
79+
trustedCertificates: ["build/neo4j/certificates/neo4j.cert", "build/neo4j/certificates/neo4j.cert"]
80+
});
81+
82+
// When
83+
driver.session().run( "RETURN 1").then( done );
84+
});
85+
6886
afterEach(function(){
6987
if( driver ) {
7088
driver.close();

0 commit comments

Comments
 (0)