File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff 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
@@ -129,7 +129,7 @@ const TrustStrategy = {
129129 " using `neo4j.v1.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This " +
130130 " is a security measure to protect against man-in-the-middle attacks. If you are just trying " +
131131 " Neo4j out and are not concerned about encryption, simply disable it using `encrypted=false` in the driver" +
132- " options." ) ) ;
132+ " options. Socket responded with: " + socket . authorizationError ) ) ;
133133 } else {
134134 onSuccess ( ) ;
135135 }
Original file line number Diff line number Diff line change @@ -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" , "test/resources/random.certificate" ]
80+ } ) ;
81+
82+ // When
83+ driver . session ( ) . run ( "RETURN 1" ) . then ( done ) ;
84+ } ) ;
85+
6886 afterEach ( function ( ) {
6987 if ( driver ) {
7088 driver . close ( ) ;
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ module.exports = function () {
7676 "to store this information by setting `knownHosts` to another path in your driver configuration - " +
7777 "and you can disable encryption there as well using `encrypted:false`." ;
7878 if ( this . error . message !== expected ) {
79- callback ( new Error ( "Given and expected results does not match: " + this . error . message + " Expected " + expected ) ) ;
79+ callback ( new Error ( "Given and expected results does not match: " + this . error . message + " Expected: " + expected ) ) ;
8080 } else {
8181 callback ( ) ;
8282 }
@@ -155,7 +155,7 @@ module.exports = function () {
155155 "certificate, or the server certificate, to the list of certificates trusted by this driver using " +
156156 "`neo4j.v1.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This is a security measure to protect " +
157157 "against man-in-the-middle attacks. If you are just trying Neo4j out and are not concerned about encryption, " +
158- "simply disable it using `encrypted=false` in the driver options." ;
158+ "simply disable it using `encrypted=false` in the driver options. Socket responded with: DEPTH_ZERO_SELF_SIGNED_CERT " ;
159159 if ( this . error . message !== expected ) {
160160 callback ( new Error ( "Given and expected results does not match: " + this . error . message + " Expected " + expected ) ) ;
161161 } else {
You can’t perform that action at this time.
0 commit comments