Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add min vault version check (#541)

Leendert de Borstd298748b1050
diff --git a/browser-extensions/chrome/src/app/pages/Login.tsx b/browser-extensions/chrome/src/app/pages/Login.tsx
index f06e833f3..ea61c4942 100644
--- a/browser-extensions/chrome/src/app/pages/Login.tsx
+++ b/browser-extensions/chrome/src/app/pages/Login.tsx
@@ -9,6 +9,7 @@ import SrpUtility from '../utils/SrpUtility';
import { useLoading } from '../context/LoadingContext';
import { VaultResponse } from '../../shared/types/webapi/VaultResponse';
import { LoginResponse } from '../../shared/types/webapi/Login';
+import { AppInfo } from '../../shared/AppInfo';
/**
* Login page
@@ -109,6 +110,13 @@ const Login: React.FC = () => {
return;
}
+ // Check if vault version is supported.
+ if (!AppInfo.isVaultVersionSupported(vaultResponseJson.vault.version)) {
+ setError('Your vault is outdated. Please login via the web client to update your vault.');
+ hideLoading();
+ return;
+ }
+
// All is good. Store auth info which makes the user logged in.
await authContext.login(credentials.username, validationResponse.token.token, validationResponse.token.refreshToken);
@@ -164,6 +172,12 @@ const Login: React.FC = () => {
return;
}
+ // Check if vault version is supported.
+ if (!AppInfo.isVaultVersionSupported(vaultResponseJson.vault.version)) {
+ setError('Your vault is outdated. Please login via the web client to update your vault.');
+ hideLoading();
+ return;
+ }
// All is good. Store auth info which makes the user logged in.
await authContext.login(credentials.username, validationResponse.token.token, validationResponse.token.refreshToken);
diff --git a/browser-extensions/chrome/src/shared/AppInfo.ts b/browser-extensions/chrome/src/shared/AppInfo.ts
new file mode 100644
index 000000000..f4c11d495
--- /dev/null
+++ b/browser-extensions/chrome/src/shared/AppInfo.ts
@@ -0,0 +1,45 @@
+/**
+ * AppInfo class which contains information about the application version.
+ */
+export class AppInfo {
+ // Current extension version - should be updated with each release
+ public static readonly VERSION = '0.10.0';
+
+ // Minimum supported AliasVault client vault version
+ public static readonly MIN_VAULT_VERSION = '1.4.1';
+
+ /**
+ * Prevent instantiation of this utility class
+ */
+ private constructor() {}
+
+ /**
+ * Checks if a given vault version is supported
+ * @param vaultVersion The version to check
+ * @returns boolean indicating if the version is supported
+ */
+ public static isVaultVersionSupported(vaultVersion: string): boolean {
+ return this.compareVersions(vaultVersion, this.MIN_VAULT_VERSION) >= 0;
+ }
+
+ /**
+ * Compares two version strings
+ * @param version1 First version string (e.g., "1.2.3")
+ * @param version2 Second version string (e.g., "1.2.0")
+ * @returns -1 if version1 < version2, 0 if equal, 1 if version1 > version2
+ */
+ private static compareVersions(version1: string, version2: string): number {
+ const parts1 = version1.split('.').map(Number);
+ const parts2 = version2.split('.').map(Number);
+
+ for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
+ const part1 = parts1[i] || 0;
+ const part2 = parts2[i] || 0;
+
+ if (part1 < part2) return -1;
+ if (part1 > part2) return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/docs/misc/release/create-new-release.md b/docs/misc/release/create-new-release.md
index ebb9c817e..578c466b3 100644
--- a/docs/misc/release/create-new-release.md
+++ b/docs/misc/release/create-new-release.md
@@ -10,11 +10,14 @@ nav_order: 1
Follow the steps in the checklist below to prepare a new release.
-## Versioning
+## Versioning client and server
- [ ] Update ./src/Shared/AliasVault.Shared.Core/AppInfo.cs and update major/minor/patch to the new version. This version will be shown in the client and admin app footer.
- [ ] Update ./install.sh `@version` in header if the install script has changed. This allows the install script to self-update when running the `./install.sh update` command on default installations.
- [ ] Update README.md install.sh download link to point to the new release version
+# Versioning browser extension
+- [ ] Update ./chrome/src/shared/AppInfo.ts with the new version for the extension and minimum supported client vault version.
+
## Docker Images
If docker containers have been added or removed:
- [ ] Verify that `.github/workflows/publish-docker-images.yml` contains references to all docker images that need to be published.