From 4bc6620c1d22962fe3c19e3192d62b02fda59808 Mon Sep 17 00:00:00 2001 From: Eric BREHAULT Date: Fri, 15 Mar 2024 11:07:37 +0100 Subject: [PATCH] use checkAuthorization (#29) --- electron-app/package-lock.json | 4 ++-- electron-app/package.json | 2 +- package.json | 2 +- server/CHANGELOG.md | 4 ++++ server/package-lock.json | 12 ++++++------ server/package.json | 2 +- server/src/logic/sync/domain/sync.entity.ts | 4 ++-- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/electron-app/package-lock.json b/electron-app/package-lock.json index 2dc6db4..b512731 100644 --- a/electron-app/package-lock.json +++ b/electron-app/package-lock.json @@ -1,12 +1,12 @@ { "name": "nuclia-sync-agent", - "version": "1.0.0", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nuclia-sync-agent", - "version": "1.0.0", + "version": "0.0.0", "license": "MIT", "dependencies": { "@nuclia/core": "^1.11.6", diff --git a/electron-app/package.json b/electron-app/package.json index 286474f..19c362d 100644 --- a/electron-app/package.json +++ b/electron-app/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "dependencies": { - "@nuclia/core": "^1.11.6", + "@nuclia/core": "^1.14.2", "cheerio": "^1.0.0-rc.12", "commander": "^11.1.0", "compression": "^1.7.4", diff --git a/package.json b/package.json index 7554b5e..076eb5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclia-sync-agent-app", - "version": "1.2.0", + "version": "1.2.1", "description": "\"This is a Nuclia Sync Agent App\"", "main": "build/index.js", "scripts": { diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index 77e4cc1..b1ed20a 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.2.1 (2024-03-15) + +- Use `checkAuthorization` to validate token + # 1.2.0 (2024-03-13) - Secure endpoints by validating the dashboard user token diff --git a/server/package-lock.json b/server/package-lock.json index c7cf123..e824284 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,15 +1,15 @@ { "name": "@nuclia/sync-agent", - "version": "1.0.9", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@nuclia/sync-agent", - "version": "1.0.9", + "version": "0.0.0", "license": "MIT", "dependencies": { - "@nuclia/core": "^1.13.0", + "@nuclia/core": "^1.14.2", "cheerio": "^1.0.0-rc.12", "commander": "^11.1.0", "compression": "^1.7.4", @@ -564,9 +564,9 @@ } }, "node_modules/@nuclia/core": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/@nuclia/core/-/core-1.13.0.tgz", - "integrity": "sha512-SWgfE2/CnECeR4RRI+RmNPf6kd+JO9Rar9lLiZApgyovzrU7t+mWakwUVShklTF3oeNmNSFjcUnjWXFBcq/4Hg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/@nuclia/core/-/core-1.14.2.tgz", + "integrity": "sha512-T9INffPXHqYeRKQiQ9+jEjRr6kZY94kWFM6WgGj8jx45DlADhKMt0K+/QS7DFMepIGq9ylAHaDWPB9qoNQE4Qg==", "peerDependencies": { "rxjs": "^7.8.0" } diff --git a/server/package.json b/server/package.json index 99d6d77..36c0f90 100644 --- a/server/package.json +++ b/server/package.json @@ -25,7 +25,7 @@ "start-server": "npm run compile && node build/start-file-system-server.js" }, "dependencies": { - "@nuclia/core": "^1.13.0", + "@nuclia/core": "^1.14.2", "cheerio": "^1.0.0-rc.12", "commander": "^11.1.0", "compression": "^1.7.4", diff --git a/server/src/logic/sync/domain/sync.entity.ts b/server/src/logic/sync/domain/sync.entity.ts index f89288a..cc99614 100644 --- a/server/src/logic/sync/domain/sync.entity.ts +++ b/server/src/logic/sync/domain/sync.entity.ts @@ -174,8 +174,8 @@ export class SyncEntity { const nuclia = new Nuclia({ ...this.kb, apiKey: '' }); nuclia.auth.authenticate({ access_token: token, refresh_token: '' }); const req = await firstValueFrom( - nuclia.knowledgeBox.getConfiguration().pipe( - map(() => true), + nuclia.rest.checkAuthorization(`/kb/${this.kb.knowledgeBox}/configure`).pipe( + map((check) => check.allowed), catchError(() => of(false)), ), );