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 = {
116
116
}
117
117
118
118
let tlsOpts = {
119
- ca : opts . trustedCertificates . map ( fs . readFileSync ) ,
119
+ ca : opts . trustedCertificates . map ( ( f ) => fs . readFileSync ( f ) ) ,
120
120
// Because we manually check for this in the connect callback, to give
121
121
// a more helpful error to the user
122
122
rejectUnauthorized : false
@@ -129,7 +129,7 @@ const TrustStrategy = {
129
129
" using `neo4j.v1.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This " +
130
130
" is a security measure to protect against man-in-the-middle attacks. If you are just trying " +
131
131
" 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 ) ) ;
133
133
} else {
134
134
onSuccess ( ) ;
135
135
}
Original file line number Diff line number Diff line change @@ -65,6 +65,24 @@ describe('trust-signed-certificates', function() {
65
65
driver . session ( ) . run ( "RETURN 1" ) . then ( done ) ;
66
66
} ) ;
67
67
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
+
68
86
afterEach ( function ( ) {
69
87
if ( driver ) {
70
88
driver . close ( ) ;
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ module.exports = function () {
76
76
"to store this information by setting `knownHosts` to another path in your driver configuration - " +
77
77
"and you can disable encryption there as well using `encrypted:false`." ;
78
78
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 ) ) ;
80
80
} else {
81
81
callback ( ) ;
82
82
}
@@ -155,7 +155,7 @@ module.exports = function () {
155
155
"certificate, or the server certificate, to the list of certificates trusted by this driver using " +
156
156
"`neo4j.v1.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This is a security measure to protect " +
157
157
"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 " ;
159
159
if ( this . error . message !== expected ) {
160
160
callback ( new Error ( "Given and expected results does not match: " + this . error . message + " Expected " + expected ) ) ;
161
161
} else {
You can’t perform that action at this time.
0 commit comments