Skip to content

Commit 182c292

Browse files
Merge pull request #52 from figo-connect/feature-remove-pinning
- emoved ssl cert pinning and bumped version to 3.1.0 - dropped support for Node.js 4.0
2 parents c0c4f0c + 7f9b78a commit 182c292

File tree

6 files changed

+790
-179
lines changed

6 files changed

+790
-179
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
language: node_js
22
before_install: npm -g install npm@latest
33
node_js:
4-
- 8
4+
- 11
5+
- 10
6+
- 8
57
- 6
6-
- 4
78
install:
89
- npm install
910
script:

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "NPM TEST",
11+
"runtimeExecutable": "npm",
12+
"runtimeArgs": [
13+
"test",
14+
"--inspect-brk=9229",
15+
],
16+
"port": 9229,
17+
"console": "integratedTerminal",
18+
"internalConsoleOptions": "openOnSessionStart",
19+
}
20+
]
21+
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ npm install
222222
You need to set the following environment variables:
223223
- `FIGO_CLIENT_ID`
224224
- `FIGO_CLIENT_SECRET`
225-
- `FIGO_API_FINGERPRINT`
226225
- `FIGO_API_ENDPOINT` (optional, defaults to `https://staging.figo.me/v3`)
227226

228227
```bash

lib/figo.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ const Config = {
5757
},
5858

5959
userAgent: 'node-figo/' + require('../package.json').version,
60-
61-
// figo Connect TLS certificate fingerprints.
62-
valid_fingerprints: [ "cdf3d326278991b9cdae4b106c9681b7ebb33810c472376a4d9c84b7b3dcd68d",
63-
"79b2a29300853b0692b1b5f2247948583aa5220fc5cde9499ac8451edbe0da50"],
6460
};
6561

6662
const RETRIABLE_ERRORS = [
@@ -76,7 +72,7 @@ const RETRIABLE_ERRORS = [
7672

7773
// Override config, e.g. to use staging evironment.
7874
const setConfig = function(config) {
79-
const fields = ['api_endpoint', 'valid_fingerprints', 'userAgent'];
75+
const fields = ['api_endpoint', 'userAgent'];
8076

8177
for (var f of fields) {
8278
if (config.hasOwnProperty(f)) {
@@ -191,11 +187,7 @@ var HttpsRequest = function(agent, path, method, callback) {
191187
request.on("error", function(error) {
192188
if (!aborted) {
193189
aborted = true;
194-
if (request.figo_ssl_error) {
195-
callback(new FigoError("ssl_error", "SSL/TLS certificate fingerprint mismatch."));
196-
} else {
197-
callback(new FigoError("socket_error", error.message, error.errno));
198-
}
190+
callback(new FigoError("socket_error", error.message, error.errno));
199191
request.abort();
200192
}
201193
});
@@ -214,17 +206,6 @@ var HttpsAgent = function() {
214206
var agent = this;
215207
var stream = tls.connect(options);
216208

217-
stream.on("secureConnect", function() {
218-
var fingerprint = crypto
219-
.createHash('sha256')
220-
.update(stream.getPeerCertificate().raw)
221-
.digest('hex');
222-
if (!~Config.valid_fingerprints.indexOf(fingerprint)) {
223-
agent.figo_request.figo_ssl_error = true;
224-
agent.figo_request.abort();
225-
}
226-
});
227-
228209
return stream;
229210
};
230211

@@ -282,7 +263,7 @@ var queryWithRetries = function (agent, authorization, contentType, path, data,
282263
};
283264

284265
var clean = function (obj) {
285-
for (var propName in obj) {
266+
for (var propName in obj) {
286267
if (obj[propName] === null || obj[propName] === undefined) {
287268
delete obj[propName];
288269
}

0 commit comments

Comments
 (0)