Skip to content

A local-first personal finance app

Check SimpleFIN access key format (#485)

Robert Dyer879869c85af8
diff --git a/src/app-simplefin/app-simplefin.js b/src/app-simplefin/app-simplefin.js
index 7c123166f1..27760987a1 100644
--- a/src/app-simplefin/app-simplefin.js
+++ b/src/app-simplefin/app-simplefin.js
@@ -266,6 +266,10 @@ function parseAccessKey(accessKey) {
let username = null;
let password = null;
let baseUrl = null;
+ if (!accessKey || !accessKey.match(/^.*\/\/.*:.*@.*$/)) {
+ console.log(`Invalid SimpleFIN access key: ${accessKey}`);
+ throw new Error(`Invalid access key`);
+ }
[scheme, rest] = accessKey.split('//');
[auth, rest] = rest.split('@');
[username, password] = auth.split(':');
diff --git a/upcoming-release-notes/485.md b/upcoming-release-notes/485.md
new file mode 100644
index 0000000000..3fd1ff078d
--- /dev/null
+++ b/upcoming-release-notes/485.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [psybers]
+---
+
+Check if SimpleFIN accessKey is in the correct format.