From cb15ad729567ebd72fac66ccffc566a44d22ade2 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 6 Oct 2023 10:59:43 +0000 Subject: [PATCH 01/58] fix: deprecated TestResetService --- packages/nocodb/src/app.module.ts | 3 - .../test/TestResetService/index.ts | 222 ------------------ .../resetMetaSakilaSqliteProject.ts | 102 -------- .../resetMysqlSakilaProject.ts | 200 ---------------- .../TestResetService/resetPgSakilaProject.ts | 191 --------------- .../controllers/test/test.controller.spec.ts | 21 -- .../src/controllers/test/test.controller.ts | 20 -- .../nocodb/src/modules/test/test.module.ts | 9 - 8 files changed, 768 deletions(-) delete mode 100644 packages/nocodb/src/controllers/test/TestResetService/index.ts delete mode 100644 packages/nocodb/src/controllers/test/TestResetService/resetMetaSakilaSqliteProject.ts delete mode 100644 packages/nocodb/src/controllers/test/TestResetService/resetMysqlSakilaProject.ts delete mode 100644 packages/nocodb/src/controllers/test/TestResetService/resetPgSakilaProject.ts delete mode 100644 packages/nocodb/src/controllers/test/test.controller.spec.ts delete mode 100644 packages/nocodb/src/controllers/test/test.controller.ts delete mode 100644 packages/nocodb/src/modules/test/test.module.ts diff --git a/packages/nocodb/src/app.module.ts b/packages/nocodb/src/app.module.ts index 6fb5683874..1a944c37f1 100644 --- a/packages/nocodb/src/app.module.ts +++ b/packages/nocodb/src/app.module.ts @@ -10,7 +10,6 @@ import { GuiMiddleware } from '~/middlewares/gui/gui.middleware'; import { DatasModule } from '~/modules/datas/datas.module'; import { EventEmitterModule } from '~/modules/event-emitter/event-emitter.module'; import { AuthService } from '~/services/auth.service'; -import { TestModule } from '~/modules/test/test.module'; import { GlobalModule } from '~/modules/global/global.module'; import { LocalStrategy } from '~/strategies/local.strategy'; import { AuthTokenStrategy } from '~/strategies/authtoken.strategy/authtoken.strategy'; @@ -31,7 +30,6 @@ export const ceModuleConfig = { GlobalModule, UsersModule, AuthModule, - ...(process.env['PLAYWRIGHT_TEST'] === 'true' ? [TestModule] : []), MetasModule, DatasModule, EventEmitterModule, @@ -41,7 +39,6 @@ export const ceModuleConfig = { load: [() => appConfig], isGlobal: true, }), - TestModule, ], providers: [ AuthService, diff --git a/packages/nocodb/src/controllers/test/TestResetService/index.ts b/packages/nocodb/src/controllers/test/TestResetService/index.ts deleted file mode 100644 index 7387c82d50..0000000000 --- a/packages/nocodb/src/controllers/test/TestResetService/index.ts +++ /dev/null @@ -1,222 +0,0 @@ -import axios from 'axios'; -import resetPgSakilaProject from './resetPgSakilaProject'; -import resetMysqlSakilaProject from './resetMysqlSakilaProject'; -import resetMetaSakilaSqliteProject from './resetMetaSakilaSqliteProject'; -import type ApiToken from '~/models/ApiToken'; -import Base from '~/models/Base'; -// import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; -import Noco from '~/Noco'; -import User from '~/models/User'; -import NocoCache from '~/cache/NocoCache'; -import { CacheDelDirection, CacheScope, MetaTable } from '~/utils/globals'; -import BaseUser from '~/models/BaseUser'; - -const workerStatus = {}; - -const loginRootUser = async () => { - const response = await axios.post( - 'http://localhost:8080/api/v1/auth/user/signin', - { email: 'user@nocodb.com', password: 'Password123.' }, - ); - - return response.data.token; -}; - -const baseTitleByType = { - sqlite: 'sampleREST', - mysql: 'externalREST', - pg: 'pgExtREST', -}; - -export class TestResetService { - private readonly parallelId; - // todo: Hack to resolve issue with pg resetting - private readonly workerId; - private readonly dbType; - private readonly isEmptyProject: boolean; - - constructor({ - parallelId, - dbType, - isEmptyProject, - workerId, - }: { - parallelId: string; - dbType: string; - isEmptyProject: boolean; - workerId: string; - }) { - this.parallelId = parallelId; - this.dbType = dbType; - this.isEmptyProject = isEmptyProject; - this.workerId = workerId; - } - - async process() { - try { - // console.log( - // `earlier workerStatus: parrelledId: ${this.parallelId}:`, - // workerStatus[this.parallelId] - // ); - - // wait till previous worker is done - while (workerStatus[this.parallelId] === 'processing') { - console.log( - `waiting for previous worker to finish parrelelId:${this.parallelId}`, - ); - await new Promise((resolve) => setTimeout(resolve, 1000)); - } - - workerStatus[this.parallelId] = 'processing'; - - const token = await loginRootUser(); - - const { base } = await this.resetProject({ - token, - dbType: this.dbType, - parallelId: this.parallelId, - workerId: this.workerId, - }); - - try { - await removeAllProjectCreatedByTheTest(this.parallelId); - await removeAllPrefixedUsersExceptSuper(this.parallelId); - await removeAllTokensCreatedByTheTest(this.parallelId); - } catch (e) { - console.log(`Error in cleaning up base: ${this.parallelId}`, e); - } - - workerStatus[this.parallelId] = 'completed'; - return { token, base }; - } catch (e) { - console.error('TestResetService:process', e); - workerStatus[this.parallelId] = 'errored'; - return { error: e }; - } - } - - async resetProject({ - token, - dbType, - parallelId, - workerId, - }: { - token: string; - dbType: string; - parallelId: string; - workerId: string; - }) { - const title = `${baseTitleByType[dbType]}${parallelId}`; - const base: Base | undefined = await Base.getByTitle(title); - - if (base) { - await this.removeProjectUsersFromCache(base); - - // Kludge: Soft reset to support PG as root DB in PW tests - // Revisit to fix this later - - // const sources = await base.getBases(); - // - // for (const base of sources) { - // await NcConnectionMgrv2.deleteAwait(base); - // await base.delete(Noco.ncMeta, { force: true }); - // } - // - // await Base.delete(base.id); - - await Base.softDelete(base.id); - } - - if (dbType == 'sqlite') { - await resetMetaSakilaSqliteProject({ - token, - title, - parallelId, - isEmptyProject: this.isEmptyProject, - }); - } else if (dbType == 'mysql') { - await resetMysqlSakilaProject({ - token, - title, - parallelId, - oldProject: base, - isEmptyProject: this.isEmptyProject, - }); - } else if (dbType == 'pg') { - await resetPgSakilaProject({ - token, - title, - parallelId: workerId, - oldProject: base, - isEmptyProject: this.isEmptyProject, - }); - } - - return { - base: await Base.getByTitle(title), - }; - } - - // todo: Remove this once user deletion improvement PR is merged - removeProjectUsersFromCache = async (base: Base) => { - const baseUsers = await BaseUser.getUsersList({ - base_id: base.id, - limit: 1000, - offset: 0, - }); - - for (const baseUser of baseUsers) { - try { - const user: User = (await User.get(baseUser.id)) as any; - await NocoCache.del(`${CacheScope.PROJECT_USER}:${base.id}:${user.id}`); - } catch (e) { - console.error('removeProjectUsersFromCache', e); - } - } - }; -} - -const removeAllProjectCreatedByTheTest = async (parallelId: string) => { - const bases = await Base.list({}); - - for (const base of bases) { - if (base.title.startsWith(`nc_test_${parallelId}_`)) { - await Base.delete(base.id); - } - } -}; - -const removeAllPrefixedUsersExceptSuper = async (parallelId: string) => { - const users = (await User.list()).filter( - (user) => !user.roles.includes('super'), - ); - - for (const user of users) { - if (user.email.startsWith(`nc_test_${parallelId}_`)) { - await NocoCache.del(`${CacheScope.USER}:${user.email}`); - await User.delete(user.id); - } - } -}; - -const removeAllTokensCreatedByTheTest = async (parallelId: string) => { - const tokens: ApiToken[] = await Noco.ncMeta.metaList( - null, - null, - MetaTable.API_TOKENS, - ); - - for (const token of tokens) { - if (token.description.startsWith(`nc_test_${parallelId}`)) { - await NocoCache.deepDel( - CacheScope.API_TOKEN, - `${CacheScope.API_TOKEN}:${token.token}`, - CacheDelDirection.CHILD_TO_PARENT, - ); - - await Noco.ncMeta.metaDelete(null, null, MetaTable.API_TOKENS, { - token: token.token, - }); - } - } -}; diff --git a/packages/nocodb/src/controllers/test/TestResetService/resetMetaSakilaSqliteProject.ts b/packages/nocodb/src/controllers/test/TestResetService/resetMetaSakilaSqliteProject.ts deleted file mode 100644 index dc29106394..0000000000 --- a/packages/nocodb/src/controllers/test/TestResetService/resetMetaSakilaSqliteProject.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { promises as fs } from 'fs'; -import path from 'path'; -import axios from 'axios'; -import type { AxiosResponse } from 'axios'; - -const sqliteFilePath = (parallelId: string) => { - const rootDir = process.cwd(); - - return `${rootDir}/test_sakila_${parallelId}.db`; -}; - -const sakilaProjectConfig = (title: string, parallelId: string) => ({ - title, - sources: [ - { - type: 'sqlite3', - config: { - client: 'sqlite3', - connection: { - client: 'sqlite3', - connection: { - filename: sqliteFilePath(parallelId), - database: 'test_sakila', - multipleStatements: true, - }, - }, - }, - inflection_column: 'camelize', - inflection_table: 'camelize', - }, - ], - external: true, -}); - -const resetMetaSakilaSqliteProject = async ({ - parallelId, - token, - title, - isEmptyProject, -}: { - parallelId: string; - token: string; - title: string; - isEmptyProject: boolean; -}) => { - await deleteSqliteFileIfExists(parallelId); - - if (!isEmptyProject) await seedSakilaSqliteFile(parallelId); - - await createProject(token, title, parallelId, isEmptyProject); -}; - -const createProject = async ( - token: string, - title: string, - parallelId: string, - isEmptyProject: boolean, -) => { - let response: AxiosResponse; - if (isEmptyProject) { - response = await axios.post( - 'http://localhost:8080/api/v1/meta/bases/', - { title }, - { - headers: { - 'xc-auth': token, - }, - }, - ); - } else { - response = await axios.post( - 'http://localhost:8080/api/v1/meta/bases/', - sakilaProjectConfig(title, parallelId), - { - headers: { - 'xc-auth': token, - }, - }, - ); - } - if (response.status !== 200) { - console.error('Error creating base', response.data); - } - return response.data; -}; - -const deleteSqliteFileIfExists = async (parallelId: string) => { - if (await fs.stat(sqliteFilePath(parallelId)).catch(() => null)) { - await fs.unlink(sqliteFilePath(parallelId)); - } -}; - -const seedSakilaSqliteFile = async (parallelId: string) => { - const testsDir = path.join(process.cwd(), 'tests'); - - await fs.copyFile( - `${testsDir}/sqlite-sakila-db/sakila.db`, - sqliteFilePath(parallelId), - ); -}; - -export default resetMetaSakilaSqliteProject; diff --git a/packages/nocodb/src/controllers/test/TestResetService/resetMysqlSakilaProject.ts b/packages/nocodb/src/controllers/test/TestResetService/resetMysqlSakilaProject.ts deleted file mode 100644 index 55e4520d58..0000000000 --- a/packages/nocodb/src/controllers/test/TestResetService/resetMysqlSakilaProject.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { promises as fs } from 'fs'; -import path from 'path'; -import axios from 'axios'; -import { knex } from 'knex'; -import type { Knex } from 'knex'; -import type Base from '~/models/Base'; -import Audit from '~/models/Audit'; - -const config = { - client: 'mysql2', - connection: { - host: 'localhost', - port: 3306, - user: 'root', - password: 'password', - database: 'sakila', - multipleStatements: true, - dateStrings: true, - }, -}; - -const extMysqlProject = (title, parallelId) => ({ - title, - sources: [ - { - type: 'mysql2', - config: { - client: 'mysql2', - connection: { - host: 'localhost', - port: '3306', - user: 'root', - password: 'password', - database: `test_sakila_${parallelId}`, - }, - }, - inflection_column: 'camelize', - inflection_table: 'camelize', - }, - ], - external: true, -}); - -const isSakilaMysqlToBeReset = async ( - knex: Knex, - parallelId: string, - base?: Base, -) => { - const tablesInDbInfo: Array = await knex.raw( - `SELECT table_name FROM information_schema.tables WHERE table_schema = 'test_sakila_${parallelId}'`, - ); - - const nonMetaTablesInDb = tablesInDbInfo[0] - .map((t) => t['TABLE_NAME']) - .filter((table) => table !== 'nc_evolutions'); - - const mysqlSakilaTablesAndViews = [ - ...mysqlSakilaTables, - ...mysqlSakilaSqlViews, - ]; - - if ( - nonMetaTablesInDb.length === 0 || - // If there are sakila tables - !nonMetaTablesInDb.includes(`actor`) || - // If there are no pg sakila tables in tables in db - !( - nonMetaTablesInDb.length === mysqlSakilaTablesAndViews.length && - nonMetaTablesInDb.every((t) => mysqlSakilaTablesAndViews.includes(t)) - ) - ) { - return true; - } - - if (!base) return true; - - const audits = await Audit.baseAuditList(base.id, {}); - - // todo: Will be fixed in the data resetting revamp - console.log(`audits:resetMysqlSakilaProject:${parallelId}`, audits?.length); - return true; -}; - -const resetSakilaMysql = async ( - knex: Knex, - parallelId: string, - isEmptyProject: boolean, -) => { - const testsDir = path.join(process.cwd(), '/tests'); - - try { - await knex.raw(`DROP DATABASE test_sakila_${parallelId}`); - } catch (e) { - console.log('Error dropping db', e); - } - await knex.raw(`CREATE DATABASE test_sakila_${parallelId}`); - - if (isEmptyProject) return; - - const trx = await knex.transaction(); - - try { - const schemaFile = await fs.readFile( - `${testsDir}/mysql-sakila-db/03-test-sakila-schema.sql`, - ); - const dataFile = await fs.readFile( - `${testsDir}/mysql-sakila-db/04-test-sakila-data.sql`, - ); - - await trx.raw( - schemaFile - .toString() - .replace(/test_sakila/g, `test_sakila_${parallelId}`), - ); - await trx.raw( - dataFile.toString().replace(/test_sakila/g, `test_sakila_${parallelId}`), - ); - - await trx.commit(); - } catch (e) { - console.log('Error resetting mysql db', e); - await trx.rollback(e); - } -}; - -const resetMysqlSakilaProject = async ({ - token, - title, - parallelId, - oldProject, - isEmptyProject, -}: { - token: string; - title: string; - parallelId: string; - oldProject?: Base | undefined; - isEmptyProject: boolean; -}) => { - const nc_knex = knex(config); - - try { - await nc_knex.raw(`USE test_sakila_${parallelId}`); - } catch (e) { - await nc_knex.raw(`CREATE DATABASE test_sakila_${parallelId}`); - await nc_knex.raw(`USE test_sakila_${parallelId}`); - } - - if ( - isEmptyProject || - (await isSakilaMysqlToBeReset(nc_knex, parallelId, oldProject)) - ) { - await resetSakilaMysql(nc_knex, parallelId, isEmptyProject); - } - - const response = await axios.post( - 'http://localhost:8080/api/v1/meta/bases/', - extMysqlProject(title, parallelId), - { - headers: { - 'xc-auth': token, - }, - }, - ); - if (response.status !== 200) { - console.error('Error creating base', response.data); - } - - await nc_knex.destroy(); -}; - -const mysqlSakilaTables = [ - 'actor', - 'address', - 'category', - 'city', - 'country', - 'customer', - 'film', - 'film_text', - 'film_actor', - 'film_category', - 'inventory', - 'language', - 'payment', - 'rental', - 'staff', - 'store', -]; - -const mysqlSakilaSqlViews = [ - 'actor_info', - 'customer_list', - 'film_list', - 'nicer_but_slower_film_list', - 'sales_by_film_category', - 'sales_by_store', - 'staff_list', -]; - -export default resetMysqlSakilaProject; diff --git a/packages/nocodb/src/controllers/test/TestResetService/resetPgSakilaProject.ts b/packages/nocodb/src/controllers/test/TestResetService/resetPgSakilaProject.ts deleted file mode 100644 index c65ba2e065..0000000000 --- a/packages/nocodb/src/controllers/test/TestResetService/resetPgSakilaProject.ts +++ /dev/null @@ -1,191 +0,0 @@ -import { promises as fs } from 'fs'; -import path from 'path'; -import axios from 'axios'; -import { knex } from 'knex'; -import type Base from '~/models/Base'; -import Audit from '~/models/Audit'; - -const config = { - client: 'pg', - connection: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'postgres', - multipleStatements: true, - }, - searchPath: ['public', 'information_schema'], - pool: { min: 0, max: 5 }, -}; - -const extMysqlProject = (title, parallelId) => ({ - title, - sources: [ - { - type: 'pg', - config: { - client: 'pg', - connection: { - host: 'localhost', - port: '5432', - user: 'postgres', - password: 'password', - database: `sakila_${parallelId}`, - }, - searchPath: ['public'], - }, - inflection_column: 'camelize', - inflection_table: 'camelize', - }, - ], - external: true, -}); - -const isSakilaPgToBeReset = async (parallelId: string, base?: Base) => { - const sakilaKnex = knex(sakilaKnexConfig(parallelId)); - - const tablesInDb: Array = ( - await sakilaKnex.raw( - `SELECT * FROM information_schema.tables WHERE table_schema = 'public'`, - ) - ).rows.map((row) => row.table_name); - - await sakilaKnex.destroy(); - - const nonMetaTablesInDb = tablesInDb.filter( - (table) => table !== 'nc_evolutions', - ); - const pgSakilaTablesAndViews = [...pgSakilaTables, ...pgSakilaSqlViews]; - - if ( - tablesInDb.length === 0 || - // If there are sakila tables - !tablesInDb.includes(`actor`) || - // If there are no pg sakila tables in tables in db - !( - nonMetaTablesInDb.length === pgSakilaTablesAndViews.length && - nonMetaTablesInDb.every((t) => pgSakilaTablesAndViews.includes(t)) - ) - ) { - return true; - } - - if (!base) return false; - - const audits = await Audit.baseAuditList(base.id, {}); - - return audits?.length > 0; -}; - -const resetSakilaPg = async (parallelId: string, isEmptyProject: boolean) => { - const testsDir = path.join(process.cwd(), '/tests'); - - if (isEmptyProject) return; - - try { - const sakilaKnex = knex(sakilaKnexConfig(parallelId)); - const schemaFile = await fs.readFile( - `${testsDir}/pg-sakila-db/01-postgres-sakila-schema.sql`, - ); - await sakilaKnex.raw(schemaFile.toString()); - - const trx = await sakilaKnex.transaction(); - const dataFile = await fs.readFile( - `${testsDir}/pg-sakila-db/02-postgres-sakila-insert-data.sql`, - ); - await trx.raw(dataFile.toString()); - await trx.commit(); - - await sakilaKnex.destroy(); - } catch (e) { - console.error(`Error resetting pg sakila db: Worker ${parallelId}`); - throw Error(`Error resetting pg sakila db: Worker ${parallelId}`); - } -}; - -const sakilaKnexConfig = (parallelId: string) => ({ - ...config, - connection: { - ...config.connection, - database: `sakila_${parallelId}`, - }, -}); - -const resetPgSakilaProject = async ({ - token, - title, - parallelId, - oldProject, - isEmptyProject, -}: { - token: string; - title: string; - parallelId: string; - oldProject?: Base | undefined; - isEmptyProject: boolean; -}) => { - const pgknex = knex(config); - - try { - await pgknex.raw(`CREATE DATABASE sakila_${parallelId}`); - } catch (e) {} - - if (isEmptyProject || (await isSakilaPgToBeReset(parallelId, oldProject))) { - await pgknex.raw(`DROP DATABASE IF EXISTS sakila_${parallelId}`); - await pgknex.raw(`CREATE DATABASE sakila_${parallelId}`); - await pgknex.destroy(); - - await resetSakilaPg(parallelId, isEmptyProject); - } - - const response = await axios.post( - 'http://localhost:8080/api/v1/meta/bases/', - extMysqlProject(title, parallelId), - { - headers: { - 'xc-auth': token, - }, - }, - ); - if (response.status !== 200) { - console.error('Error creating base', response.data); - throw new Error(response.data); - } -}; - -const pgSakilaTables = [ - 'country', - 'city', - 'actor', - 'film_actor', - 'category', - 'film_category', - 'language', - 'film', - 'payment_p2007_01', - 'payment_p2007_02', - 'payment_p2007_03', - 'payment_p2007_04', - 'payment_p2007_05', - 'payment_p2007_06', - 'payment', - 'customer', - 'inventory', - 'rental', - 'address', - 'staff', - 'store', -]; - -const pgSakilaSqlViews = [ - 'actor_info', - 'customer_list', - 'film_list', - 'nicer_but_slower_film_list', - 'sales_by_film_category', - 'sales_by_store', - 'staff_list', -]; - -export default resetPgSakilaProject; diff --git a/packages/nocodb/src/controllers/test/test.controller.spec.ts b/packages/nocodb/src/controllers/test/test.controller.spec.ts deleted file mode 100644 index 2a4046c946..0000000000 --- a/packages/nocodb/src/controllers/test/test.controller.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Test } from '@nestjs/testing'; -import { TestService } from '../../modules/test/test.service'; -import { TestController } from './test.controller'; -import type { TestingModule } from '@nestjs/testing'; - -describe('TestController', () => { - let controller: TestController; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [TestController], - providers: [TestService], - }).compile(); - - controller = module.get(TestController); - }); - - it('should be defined', () => { - expect(controller).toBeDefined(); - }); -}); diff --git a/packages/nocodb/src/controllers/test/test.controller.ts b/packages/nocodb/src/controllers/test/test.controller.ts deleted file mode 100644 index aa96ab7685..0000000000 --- a/packages/nocodb/src/controllers/test/test.controller.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Controller, HttpCode, Post, Req } from '@nestjs/common'; -import { TestResetService } from '~/controllers/test/TestResetService'; - -@Controller() -export class TestController { - constructor() {} - - @Post('/api/v1/meta/test/reset') - @HttpCode(200) - async reset(@Req() req) { - const service = new TestResetService({ - parallelId: req.body.parallelId, - dbType: req.body.dbType, - isEmptyProject: req.body.isEmptyProject, - workerId: req.body.workerId, - }); - - return await service.process(); - } -} diff --git a/packages/nocodb/src/modules/test/test.module.ts b/packages/nocodb/src/modules/test/test.module.ts deleted file mode 100644 index 3c029e7582..0000000000 --- a/packages/nocodb/src/modules/test/test.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TestController } from '~/controllers/test/test.controller'; - -@Module({ - controllers: [ - ...(process.env.NC_WORKER_CONTAINER !== 'true' ? [TestController] : []), - ], -}) -export class TestModule {} From 13328811c4fb494878913db9661e05e393bbd6d0 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 6 Oct 2023 10:59:44 +0000 Subject: [PATCH 02/58] feat: implement filter agent for all request points --- packages/nocodb/src/helpers/webhookHelpers.ts | 14 ++++++++++++-- packages/nocodb/src/plugins/backblaze/Backblaze.ts | 6 +++++- packages/nocodb/src/plugins/discord/Discord.ts | 7 +++++++ packages/nocodb/src/plugins/gcs/Gcs.ts | 6 +++++- .../src/plugins/linode/LinodeObjectStorage.ts | 6 +++++- .../nocodb/src/plugins/mattermost/Mattermost.ts | 7 +++++++ packages/nocodb/src/plugins/mino/Minio.ts | 6 +++++- packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts | 6 +++++- packages/nocodb/src/plugins/s3/S3.ts | 6 +++++- .../src/plugins/scaleway/ScalewayObjectStorage.ts | 6 +++++- packages/nocodb/src/plugins/slack/Slack.ts | 7 +++++++ packages/nocodb/src/plugins/spaces/Spaces.ts | 6 +++++- packages/nocodb/src/plugins/storage/Local.ts | 3 +++ packages/nocodb/src/plugins/teams/Teams.ts | 7 +++++++ packages/nocodb/src/plugins/upcloud/UpoCloud.ts | 6 +++++- packages/nocodb/src/plugins/vultr/Vultr.ts | 6 +++++- packages/nocodb/src/services/utils.service.ts | 7 +++++++ 17 files changed, 100 insertions(+), 12 deletions(-) diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index 0988a95ccd..fac8f25147 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -1,5 +1,7 @@ import Handlebars from 'handlebars'; import { v4 as uuidv4 } from 'uuid'; +import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import NcPluginMgrv2 from './NcPluginMgrv2'; import type { Column, FormView, Hook, Model, View } from '~/models'; import type { HookLogType } from 'nocodb-sdk'; @@ -182,7 +184,7 @@ export async function handleHttpWebHook( user, constructWebHookData(hook, model, view, prevData, newData), ); - return require('axios')(req); + return axios(req); } export function axiosRequestMake(_apiMeta, _user, data) { @@ -219,6 +221,8 @@ export function axiosRequestMake(_apiMeta, _user, data) { } } apiMeta.response = {}; + const url = parseBody(apiMeta.path, data); + const req = { params: apiMeta.parameters ? apiMeta.parameters.reduce((paramsObj, param) => { @@ -228,7 +232,7 @@ export function axiosRequestMake(_apiMeta, _user, data) { return paramsObj; }, {}) : {}, - url: parseBody(apiMeta.path, data), + url: url, method: apiMeta.method, data: apiMeta.body, headers: apiMeta.headers @@ -240,6 +244,12 @@ export function axiosRequestMake(_apiMeta, _user, data) { }, {}) : {}, withCredentials: true, + httpAgent: useAgent(url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(url, { + stopPortScanningByUrlRedirection: true, + }), }; return req; } diff --git a/packages/nocodb/src/plugins/backblaze/Backblaze.ts b/packages/nocodb/src/plugins/backblaze/Backblaze.ts index 31e0bf23c7..949bacfd39 100644 --- a/packages/nocodb/src/plugins/backblaze/Backblaze.ts +++ b/packages/nocodb/src/plugins/backblaze/Backblaze.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -50,7 +51,10 @@ export default class Backblaze implements IStorageAdapterV2 { return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/discord/Discord.ts b/packages/nocodb/src/plugins/discord/Discord.ts index 69bb697982..a0b4a848d2 100644 --- a/packages/nocodb/src/plugins/discord/Discord.ts +++ b/packages/nocodb/src/plugins/discord/Discord.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; export default class Discord implements IWebhookNotificationAdapter { @@ -11,6 +12,12 @@ export default class Discord implements IWebhookNotificationAdapter { try { return await axios.post(webhook_url, { content, + httpAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), }); } catch (e) { console.log(e); diff --git a/packages/nocodb/src/plugins/gcs/Gcs.ts b/packages/nocodb/src/plugins/gcs/Gcs.ts index 783c26c789..34f37c9c5e 100644 --- a/packages/nocodb/src/plugins/gcs/Gcs.ts +++ b/packages/nocodb/src/plugins/gcs/Gcs.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import { Storage } from '@google-cloud/storage'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import type { StorageOptions } from '@google-cloud/storage'; @@ -106,7 +107,10 @@ export default class Gcs implements IStorageAdapterV2 { fileCreateByUrl(destPath: string, url: string): Promise { return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { this.storageClient .bucket(this.bucketName) diff --git a/packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts b/packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts index eaa6d14d86..29b658f485 100644 --- a/packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts +++ b/packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -49,7 +50,10 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/mattermost/Mattermost.ts b/packages/nocodb/src/plugins/mattermost/Mattermost.ts index a52eed44a7..3facd4c4c1 100644 --- a/packages/nocodb/src/plugins/mattermost/Mattermost.ts +++ b/packages/nocodb/src/plugins/mattermost/Mattermost.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; export default class Mattermost implements IWebhookNotificationAdapter { @@ -11,6 +12,12 @@ export default class Mattermost implements IWebhookNotificationAdapter { try { return await axios.post(webhook_url, { text, + httpAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), }); } catch (e) { console.log(e); diff --git a/packages/nocodb/src/plugins/mino/Minio.ts b/packages/nocodb/src/plugins/mino/Minio.ts index 69ae2346d9..b6a493412e 100644 --- a/packages/nocodb/src/plugins/mino/Minio.ts +++ b/packages/nocodb/src/plugins/mino/Minio.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import { Client as MinioClient } from 'minio'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -96,7 +97,10 @@ export default class Minio implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts b/packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts index c9d775b08a..c2eeaa95cb 100644 --- a/packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts +++ b/packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -49,7 +50,10 @@ export default class OvhCloud implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/s3/S3.ts b/packages/nocodb/src/plugins/s3/S3.ts index 0e6bac01a0..5b02391af9 100644 --- a/packages/nocodb/src/plugins/s3/S3.ts +++ b/packages/nocodb/src/plugins/s3/S3.ts @@ -3,6 +3,7 @@ import { promisify } from 'util'; import { GetObjectCommand, S3 as S3Client } from '@aws-sdk/client-s3'; import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -56,7 +57,10 @@ export default class S3 implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts b/packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts index a841d9fb74..75c2141906 100644 --- a/packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts +++ b/packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -99,7 +100,10 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/slack/Slack.ts b/packages/nocodb/src/plugins/slack/Slack.ts index e9f6f0ba71..62d1283bc1 100644 --- a/packages/nocodb/src/plugins/slack/Slack.ts +++ b/packages/nocodb/src/plugins/slack/Slack.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; export default class Slack implements IWebhookNotificationAdapter { @@ -11,6 +12,12 @@ export default class Slack implements IWebhookNotificationAdapter { try { return await axios.post(webhook_url, { text, + httpAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), }); } catch (e) { console.log(e); diff --git a/packages/nocodb/src/plugins/spaces/Spaces.ts b/packages/nocodb/src/plugins/spaces/Spaces.ts index eb7612527b..998f6b1597 100644 --- a/packages/nocodb/src/plugins/spaces/Spaces.ts +++ b/packages/nocodb/src/plugins/spaces/Spaces.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -49,7 +50,10 @@ export default class Spaces implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/storage/Local.ts b/packages/nocodb/src/plugins/storage/Local.ts index 05b6b2dab4..9564122842 100644 --- a/packages/nocodb/src/plugins/storage/Local.ts +++ b/packages/nocodb/src/plugins/storage/Local.ts @@ -3,6 +3,7 @@ import path from 'path'; import { promisify } from 'util'; import mkdirp from 'mkdirp'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { NcError } from '~/helpers/catchError'; @@ -40,6 +41,8 @@ export default class Local implements IStorageAdapterV2 { 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36', origin: 'https://www.airtable.com/', }, + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), }) .then(async (response) => { await mkdirp(path.dirname(destPath)); diff --git a/packages/nocodb/src/plugins/teams/Teams.ts b/packages/nocodb/src/plugins/teams/Teams.ts index 64940393c2..9b99c17179 100644 --- a/packages/nocodb/src/plugins/teams/Teams.ts +++ b/packages/nocodb/src/plugins/teams/Teams.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; export default class Teams implements IWebhookNotificationAdapter { @@ -11,6 +12,12 @@ export default class Teams implements IWebhookNotificationAdapter { try { return await axios.post(webhook_url, { Text, + httpAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(webhook_url, { + stopPortScanningByUrlRedirection: true, + }), }); } catch (e) { console.log(e); diff --git a/packages/nocodb/src/plugins/upcloud/UpoCloud.ts b/packages/nocodb/src/plugins/upcloud/UpoCloud.ts index 7043fe5adf..019a5dde1e 100644 --- a/packages/nocodb/src/plugins/upcloud/UpoCloud.ts +++ b/packages/nocodb/src/plugins/upcloud/UpoCloud.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -49,7 +50,10 @@ export default class UpoCloud implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/plugins/vultr/Vultr.ts b/packages/nocodb/src/plugins/vultr/Vultr.ts index 3e64adbfd3..b0f90a5db3 100644 --- a/packages/nocodb/src/plugins/vultr/Vultr.ts +++ b/packages/nocodb/src/plugins/vultr/Vultr.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import { promisify } from 'util'; import AWS from 'aws-sdk'; import axios from 'axios'; +import { useAgent } from 'request-filtering-agent'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { Readable } from 'stream'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; @@ -49,7 +50,10 @@ export default class Vultr implements IStorageAdapterV2 { }; return new Promise((resolve, reject) => { axios - .get(url) + .get(url, { + httpAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + httpsAgent: useAgent(url, { stopPortScanningByUrlRedirection: true }), + }) .then((response) => { uploadParams.Body = response.data; uploadParams.Key = key; diff --git a/packages/nocodb/src/services/utils.service.ts b/packages/nocodb/src/services/utils.service.ts index db34c0e978..000ee4f137 100644 --- a/packages/nocodb/src/services/utils.service.ts +++ b/packages/nocodb/src/services/utils.service.ts @@ -3,6 +3,7 @@ import axios from 'axios'; import { compareVersions, validate } from 'compare-versions'; import { ViewTypes } from 'nocodb-sdk'; import { ConfigService } from '@nestjs/config'; +import { useAgent } from 'request-filtering-agent'; import type { AppConfig } from '~/interface/config'; import { NC_ATTACHMENT_FIELD_SIZE } from '~/constants'; import SqlMgrv2 from '~/db/sql-mgr/v2/SqlMgrv2'; @@ -152,6 +153,12 @@ export class UtilsService { : {}, responseType: apiMeta.responseType || 'json', withCredentials: true, + httpAgent: useAgent(apiMeta.url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(apiMeta.url, { + stopPortScanningByUrlRedirection: true, + }), }; const data = await axios(_req); return data?.data; From 0f12be44e96bc56e59809f7727acfab3207cfa60 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 6 Oct 2023 10:59:44 +0000 Subject: [PATCH 03/58] feat: NC_ALLOW_LOCAL_HOOKS --- .../020.environment-variables.md | 5 +++-- packages/nocodb/src/helpers/webhookHelpers.ts | 18 +++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/noco-docs/docs/020.getting-started/020.environment-variables.md b/packages/noco-docs/docs/020.getting-started/020.environment-variables.md index b82a71f320..4cc9bd0f7c 100644 --- a/packages/noco-docs/docs/020.getting-started/020.environment-variables.md +++ b/packages/noco-docs/docs/020.getting-started/020.environment-variables.md @@ -62,5 +62,6 @@ For production usecases, it is **recommended** to configure | NC_MINIMAL_DBS | Create a new SQLite file for each project. All the db files are stored in `nc_minimal_dbs` folder in current working directory. (This option restricts project creation on external sources) | | | NC_DISABLE_AUDIT | Disable Audit Log | `false` | | NC_AUTOMATION_LOG_LEVEL | Possible Values: `OFF`, `ERROR`, `ALL`. See [Webhooks](/developer-resources/webhooks#call-log) for details. | `OFF` | -| NC_SECURE_ATTACHMENTS | Allow accessing attachments only through presigned urls. To enable secure set value as `true` any other value treated as false. (⚠ this will make existing links inaccessible ⚠) | `false` | -| NC_ATTACHMENT_EXPIRE_SECONDS | How many seconds before expiring presigned attachment urls. (Attachments will expire in at least set seconds and at most 10mins after set time) | 7200 (2 hours) | \ No newline at end of file +| NC_SECURE_ATTACHMENTS | Allow accessing attachments only through presigned urls. To enable set value as `true` any other value treated as false. (⚠ this will make existing links inaccessible ⚠) | `false` | +| NC_ATTACHMENT_EXPIRE_SECONDS | How many seconds before expiring presigned attachment urls. (Attachments will expire in at least set seconds and at most 10mins after set time) | 7200 (2 hours) | +| NC_ALLOW_LOCAL_HOOKS | To enable set value as `true` any other value treated as false. (⚠ this will allow webhooks to call local links which can raise security issues ⚠) | `false` | \ No newline at end of file diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index fac8f25147..3641a84b9b 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -178,7 +178,7 @@ export async function handleHttpWebHook( user, prevData, newData, -) { +): Promise { const req = axiosRequestMake( apiMeta, user, @@ -244,12 +244,16 @@ export function axiosRequestMake(_apiMeta, _user, data) { }, {}) : {}, withCredentials: true, - httpAgent: useAgent(url, { - stopPortScanningByUrlRedirection: true, - }), - httpsAgent: useAgent(url, { - stopPortScanningByUrlRedirection: true, - }), + ...(process.env.NC_ALLOW_LOCAL_HOOKS !== 'true' + ? { + httpAgent: useAgent(url, { + stopPortScanningByUrlRedirection: true, + }), + httpsAgent: useAgent(url, { + stopPortScanningByUrlRedirection: true, + }), + } + : {}), }; return req; } From 7d8e4dc1dae2ac388d1a7e1dd4f915f2a2a112bd Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 6 Oct 2023 10:59:44 +0000 Subject: [PATCH 04/58] fix: allow local webhooks for testing --- packages/nocodb/src/run/testDocker.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nocodb/src/run/testDocker.ts b/packages/nocodb/src/run/testDocker.ts index 27111dc259..6391c75dec 100644 --- a/packages/nocodb/src/run/testDocker.ts +++ b/packages/nocodb/src/run/testDocker.ts @@ -23,6 +23,7 @@ server.use( server.set('view engine', 'ejs'); process.env[`DEBUG`] = 'xc*'; +process.env[`NC_ALLOW_LOCAL_HOOKS`] = 'true'; (async () => { const httpServer = server.listen(process.env.PORT || 8080, async () => { From 7f289faf2a57bc6251e4a748d782bd9edf353e8b Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 6 Oct 2023 16:53:20 +0530 Subject: [PATCH 05/58] chore: install request-filtering-agent Signed-off-by: mertmit --- packages/nocodb/package.json | 1 + pnpm-lock.yaml | 190 ++++++++++++++++++++--------------- 2 files changed, 108 insertions(+), 83 deletions(-) diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json index 9acf95d692..af673a73d1 100644 --- a/packages/nocodb/package.json +++ b/packages/nocodb/package.json @@ -154,6 +154,7 @@ "pg": "^8.10.0", "redlock": "^5.0.0-beta.2", "reflect-metadata": "^0.1.13", + "request-filtering-agent": "^1.1.2", "request-ip": "^2.1.3", "rmdir": "^1.2.0", "rxjs": "^7.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c48d37a1ab..5ba656b2fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,7 +38,7 @@ importers: version: 4.1.1(vue@3.3.4) '@pinia/nuxt': specifier: ^0.4.11 - version: 0.4.11(typescript@5.2.2)(vue@3.3.4) + version: 0.4.11(vue@3.3.4) '@vue-flow/additional-components': specifier: ^1.2.0 version: 1.2.0(@vue-flow/core@1.3.0)(vue@3.3.4) @@ -122,7 +122,7 @@ importers: version: 1.0.2 pinia: specifier: ^2.1.4 - version: 2.1.4(typescript@5.2.2)(vue@3.3.4) + version: 2.1.4(vue@3.3.4) qrcode: specifier: ^1.5.1 version: 1.5.1 @@ -192,7 +192,7 @@ importers: devDependencies: '@antfu/eslint-config': specifier: ^0.26.0 - version: 0.26.0(eslint@8.33.0)(typescript@5.2.2) + version: 0.26.0(eslint@8.33.0) '@esbuild-plugins/node-modules-polyfill': specifier: ^0.2.2 version: 0.2.2(esbuild@0.19.2) @@ -342,7 +342,7 @@ importers: version: 6.0.3 nuxt: specifier: ^3.6.5 - version: 3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(typescript@5.2.2) + version: 3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4) nuxt-windicss: specifier: ^2.6.1 version: 2.6.1(vite@4.4.9) @@ -354,7 +354,7 @@ importers: version: 1.63.4 ts-loader: specifier: ^9.4.4 - version: 9.4.4(typescript@5.2.2)(webpack@5.88.2) + version: 9.4.4(webpack@5.88.2) unplugin-icons: specifier: ^0.14.15 version: 0.14.15(@vue/compiler-sfc@3.2.37) @@ -703,6 +703,9 @@ importers: reflect-metadata: specifier: ^0.1.13 version: 0.1.13 + request-filtering-agent: + specifier: ^1.1.2 + version: 1.1.2 request-ip: specifier: ^2.1.3 version: 2.1.3 @@ -1113,20 +1116,20 @@ packages: /@ant-design/icons-vue@6.1.0(vue@3.3.4): resolution: {integrity: sha512-EX6bYm56V+ZrKN7+3MT/ubDkvJ5rK/O2t380WFRflDcVFgsvl3NLH7Wxeau6R8DbrO5jWR6DSTC3B6gYFp77AA==} peerDependencies: - vue: '>=3.0.3' + vue: latest dependencies: '@ant-design/colors': 6.0.0 '@ant-design/icons-svg': 4.3.1 vue: 3.3.4 dev: false - /@antfu/eslint-config-basic@0.26.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0)(typescript@5.2.2): + /@antfu/eslint-config-basic@0.26.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0): resolution: {integrity: sha512-l/Omn5HuI3VgHPGJ13pqdGEdF7D7HSzN85KF0HaR/jm24QzL2kkFeZJuglv+YSXyVDI1eAbzF52TlJUz1cxqzQ==} peerDependencies: eslint: '>=7.4.0' dependencies: eslint: 8.33.0 - eslint-plugin-antfu: 0.26.0(eslint@8.33.0)(typescript@5.2.2) + eslint-plugin-antfu: 0.26.0(eslint@8.33.0) eslint-plugin-eslint-comments: 3.2.0(eslint@8.33.0) eslint-plugin-html: 7.1.0 eslint-plugin-import: 2.28.1(@typescript-eslint/parser@5.62.0)(eslint@8.33.0) @@ -1146,12 +1149,12 @@ packages: - typescript dev: true - /@antfu/eslint-config-react@0.26.0(eslint@8.33.0)(typescript@5.2.2): + /@antfu/eslint-config-react@0.26.0(eslint@8.33.0): resolution: {integrity: sha512-QkRhzivKAtTVtLMFXt7Sl+hBM/LCAU+EUpIxTqw/h0uufYmzIrbdVwkxPntZaXl5p/qLZqQOZG3Iu7oek+MNeA==} peerDependencies: eslint: '>=7.4.0' dependencies: - '@antfu/eslint-config-ts': 0.26.0(eslint@8.33.0)(typescript@5.2.2) + '@antfu/eslint-config-ts': 0.26.0(eslint@8.33.0) eslint: 8.33.0 eslint-plugin-react: 7.33.2(eslint@8.33.0) transitivePeerDependencies: @@ -1161,29 +1164,28 @@ packages: - typescript dev: true - /@antfu/eslint-config-ts@0.26.0(eslint@8.33.0)(typescript@5.2.2): + /@antfu/eslint-config-ts@0.26.0(eslint@8.33.0): resolution: {integrity: sha512-LnJgBP+XAsGijfmjAZk6BDxlt7UYGiXyCIviLDgg8bmPaLAX3I+i0wmj9DwhDIYeXForeP/Io+dBT63k5BheBw==} peerDependencies: eslint: '>=7.4.0' - typescript: '>=3.9' + typescript: latest dependencies: - '@antfu/eslint-config-basic': 0.26.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0)(typescript@5.2.2) - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0)(typescript@5.2.2) - '@typescript-eslint/parser': 5.62.0(eslint@8.33.0)(typescript@5.2.2) + '@antfu/eslint-config-basic': 0.26.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0) + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0) + '@typescript-eslint/parser': 5.62.0(eslint@8.33.0) eslint: 8.33.0 - typescript: 5.2.2 transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color dev: true - /@antfu/eslint-config-vue@0.26.0(eslint@8.33.0)(typescript@5.2.2): + /@antfu/eslint-config-vue@0.26.0(eslint@8.33.0): resolution: {integrity: sha512-a4ov8vzOzV5WPBSXIwg1oDnpSEOaxpvqz9cZK/lwqDsS+tk2QAI6yfcxwbhMIDUy3pA3u9B62K9tP+9HhqncIw==} peerDependencies: eslint: '>=7.4.0' dependencies: - '@antfu/eslint-config-ts': 0.26.0(eslint@8.33.0)(typescript@5.2.2) + '@antfu/eslint-config-ts': 0.26.0(eslint@8.33.0) eslint: 8.33.0 eslint-plugin-vue: 9.17.0(eslint@8.33.0) transitivePeerDependencies: @@ -1193,15 +1195,15 @@ packages: - typescript dev: true - /@antfu/eslint-config@0.26.0(eslint@8.33.0)(typescript@5.2.2): + /@antfu/eslint-config@0.26.0(eslint@8.33.0): resolution: {integrity: sha512-3f+JKBYPZZot5cdS4gkZxuiytUTfHWhsKS1UmNhqEn11G5BmzYSu1LRf0K/n10hb/u+GUtZJwKAovu6qnQBM9w==} peerDependencies: eslint: '>=7.4.0' dependencies: - '@antfu/eslint-config-react': 0.26.0(eslint@8.33.0)(typescript@5.2.2) - '@antfu/eslint-config-vue': 0.26.0(eslint@8.33.0)(typescript@5.2.2) - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0)(typescript@5.2.2) - '@typescript-eslint/parser': 5.62.0(eslint@8.33.0)(typescript@5.2.2) + '@antfu/eslint-config-react': 0.26.0(eslint@8.33.0) + '@antfu/eslint-config-vue': 0.26.0(eslint@8.33.0) + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0) + '@typescript-eslint/parser': 5.62.0(eslint@8.33.0) eslint: 8.33.0 eslint-plugin-eslint-comments: 3.2.0(eslint@8.33.0) eslint-plugin-html: 7.1.0 @@ -3226,7 +3228,7 @@ packages: resolution: {integrity: sha512-wmsfNHJQgSX0HFA726r+cm6ixYs+z/KLxfg1cx6xZ1PBGeZsuQCACdNdoKckyr/IH8FgIbBoIH0/6QiSbW3tEQ==} peerDependencies: '@vue/composition-api': ^1.0.0-rc.1 - vue: ^2.0.0 || >=3.0.5 + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -3240,7 +3242,7 @@ packages: resolution: {integrity: sha512-c9X82nppYjSxjlITO6jdLLdt9HoyZzqEWpqDL2V6NJd859d6GCh/2AHeRXk+37uRJ1UdTkCuty93WOEqja8quw==} engines: {node: '>=12'} peerDependencies: - vue: ^3.2.0 + vue: latest dependencies: '@ctrl/tinycolor': 3.6.1 lodash-es: 4.17.21 @@ -4377,7 +4379,7 @@ packages: /@iconify/vue@4.1.1(vue@3.3.4): resolution: {integrity: sha512-RL85Bm/DAe8y6rT6pux7D2FJSiUEM/TPfyK7GrbAOfTSwrhvwJW+S5yijdGcmtXouA8MtuH9C7l4hiSE4mLMjg==} peerDependencies: - vue: '>=3' + vue: latest dependencies: '@iconify/types': 2.0.0 vue: 3.3.4 @@ -5229,7 +5231,7 @@ packages: /@nestjs/schematics@10.0.1(chokidar@3.5.3)(typescript@5.2.2): resolution: {integrity: sha512-buxpYtSwOmWyf0nUJWJCkCkYITwbOfIEKHTnGS7sDbcfaajrOFXb5pPAGD2E1CUb3C1+NkQIURPKzs0IouZTQg==} peerDependencies: - typescript: '>=4.8.2' + typescript: latest dependencies: '@angular-devkit/core': 16.1.0(chokidar@3.5.3) '@angular-devkit/schematics': 16.1.0(chokidar@3.5.3) @@ -5653,11 +5655,11 @@ packages: /@nuxt/ui-templates@1.3.1: resolution: {integrity: sha512-5gc02Pu1HycOVUWJ8aYsWeeXcSTPe8iX8+KIrhyEtEoOSkY0eMBuo0ssljB8wALuEmepv31DlYe5gpiRwkjESA==} - /@nuxt/vite-builder@3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(typescript@5.2.2)(vue@3.3.4): + /@nuxt/vite-builder@3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(vue@3.3.4): resolution: {integrity: sha512-pwSpt257ApCp3XWUs8vrC7X9QHeHUv5PbbIR3+5w0n5f95XPNOQWDJa2fTPX/H6oaRJCPYAsBPqiQhQ7qW/NZQ==} engines: {node: ^14.18.0 || >=16.10.0} peerDependencies: - vue: ^3.3.4 + vue: latest dependencies: '@nuxt/kit': 3.6.5 '@rollup/plugin-replace': 5.0.2(rollup@3.28.1) @@ -5692,7 +5694,7 @@ packages: unplugin: 1.4.0 vite: 4.3.9(@types/node@20.3.1)(sass@1.63.4) vite-node: 0.33.0(@types/node@20.3.1)(sass@1.63.4) - vite-plugin-checker: 0.6.2(eslint@8.33.0)(typescript@5.2.2)(vite@4.3.9) + vite-plugin-checker: 0.6.2(eslint@8.33.0)(vite@4.3.9) vue: 3.3.4 vue-bundle-renderer: 1.0.3 transitivePeerDependencies: @@ -6116,11 +6118,11 @@ packages: '@parcel/watcher-win32-x64': 2.3.0 dev: true - /@pinia/nuxt@0.4.11(typescript@5.2.2)(vue@3.3.4): + /@pinia/nuxt@0.4.11(vue@3.3.4): resolution: {integrity: sha512-bhuNFngJpmBCdAqWguezNJ/oJFR7wvKieqiZrmmdmPR07XjsidAw8RLXHMZE9kUm32M9E6T057OBbG/22jERTg==} dependencies: '@nuxt/kit': 3.7.0 - pinia: 2.1.4(typescript@5.2.2)(vue@3.3.4) + pinia: 2.1.4(vue@3.3.4) transitivePeerDependencies: - '@vue/composition-api' - rollup @@ -7810,7 +7812,7 @@ packages: dev: false optional: true - /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0)(typescript@5.2.2): + /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.33.0): resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -7822,7 +7824,7 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.8.0 - '@typescript-eslint/parser': 5.62.0(eslint@8.33.0)(typescript@5.2.2) + '@typescript-eslint/parser': 5.62.0(eslint@8.33.0) '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.33.0)(typescript@5.2.2) '@typescript-eslint/utils': 5.62.0(eslint@8.33.0)(typescript@5.2.2) @@ -7833,7 +7835,6 @@ packages: natural-compare-lite: 1.4.0 semver: 7.5.4 tsutils: 3.21.0(typescript@5.2.2) - typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true @@ -7897,7 +7898,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.62.0(eslint@8.33.0)(typescript@5.2.2): + /@typescript-eslint/parser@5.62.0(eslint@8.33.0): resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -7912,7 +7913,6 @@ packages: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2) debug: 4.3.4(supports-color@8.1.1) eslint: 8.33.0 - typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true @@ -8233,7 +8233,7 @@ packages: /@unhead/vue@1.3.9(vue@3.3.4): resolution: {integrity: sha512-rVAsRLBc+3Y//NRmr7vmRs5yhIf65jYSvcj0V5DtDfDwql7BbGgc3VIIEvY0+EjLQuNsS5kxwm78LSPCIl/3Xw==} peerDependencies: - vue: '>=2.7 || >=3' + vue: latest dependencies: '@unhead/schema': 1.3.9 '@unhead/shared': 1.3.9 @@ -8501,7 +8501,7 @@ packages: engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^4.0.0 - vue: ^3.0.0 + vue: latest dependencies: '@babel/core': 7.22.11 '@babel/plugin-transform-typescript': 7.22.11(@babel/core@7.22.11) @@ -8517,7 +8517,7 @@ packages: engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^4.0.0 - vue: ^3.2.25 + vue: latest dependencies: vite: 4.3.9(@types/node@20.3.1)(sass@1.63.4) vue: 3.3.4 @@ -8572,7 +8572,7 @@ packages: resolution: {integrity: sha512-a5F2y0WdPxaxTAcN7mSYVZ6A2kDSxenp+YwMt/2ldFRmCIP4jCbXEsTZfcpUe5zhlehfbyTTYbEw03w3YW24aA==} peerDependencies: '@vue-flow/core': ^1.0.0 - vue: ^3.2.37 + vue: latest dependencies: '@types/d3-selection': 3.0.6 '@types/d3-zoom': 3.0.4 @@ -8585,7 +8585,7 @@ packages: /@vue-flow/core@1.3.0(vue@3.3.4): resolution: {integrity: sha512-hitjBy8RTw8gixcgJ9sjfZWyI6KNyKp4ffxTz/O4ZN/7TMwunEdc3cFHuU7R6J1OEhZ+HnlMRGrXmzXiIfdJow==} peerDependencies: - vue: ^3.2.25 + vue: latest dependencies: '@vueuse/core': 9.13.0(vue@3.3.4) d3-drag: 3.0.0 @@ -8600,7 +8600,7 @@ packages: resolution: {integrity: sha512-0/2A4kWLTCNEx+DDQKLvs7zXpfjgAbGBZ58SIvDN1DjGXhG4WaIUZtgMqzA6bvc5dNN7RaOatZYubkVumwmjWA==} engines: {node: '>=16.14.0'} peerDependencies: - vue: ^2.7.0 || ^3.2.25 + vue: latest peerDependenciesMeta: vue: optional: true @@ -8642,7 +8642,7 @@ packages: /@vue/compat@3.3.4(vue@3.3.4): resolution: {integrity: sha512-VwAsPqUqRJVxeLQPUC03Sa5d+T8UG2Qv4VItq74KmNvtQlRXICpa/sqq12BcyBB4Tz1U5paOEZxWCUoXkrZ9QQ==} peerDependencies: - vue: 3.3.4 + vue: latest dependencies: '@babel/parser': 7.22.11 estree-walker: 2.0.2 @@ -8765,7 +8765,7 @@ packages: /@vue/server-renderer@3.3.4(vue@3.3.4): resolution: {integrity: sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==} peerDependencies: - vue: 3.3.4 + vue: latest dependencies: '@vue/compiler-ssr': 3.3.4 '@vue/shared': 3.3.4 @@ -8781,7 +8781,7 @@ packages: /@vue/test-utils@2.0.2(vue@3.3.4): resolution: {integrity: sha512-E2P4oXSaWDqTZNbmKZFVLrNN/siVN78YkEqs7pHryWerrlZR9bBFLWdJwRoguX45Ru6HxIflzKl4vQvwRMwm5g==} peerDependencies: - vue: ^3.0.1 + vue: latest dependencies: vue: 3.3.4 dev: true @@ -8819,7 +8819,7 @@ packages: resolution: {integrity: sha512-PRRgbATMpoeUmkCEBtUeJgOwtew8s+4UsEd+Pm7MhkjL2ihCNrSqxNVtM6NFE4uP2sWnkGcZpCjPuNSxowJ1Ow==} peerDependencies: '@vue/composition-api': ^1.1.0 - vue: ^2.6.0 || ^3.2.0 + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -8912,7 +8912,7 @@ packages: '@vueuse/core': 10.2.1(vue@3.3.4) '@vueuse/metadata': 10.2.1 local-pkg: 0.4.3 - nuxt: 3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(typescript@5.2.2) + nuxt: 3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4) vue-demi: 0.14.5(vue@3.3.4) transitivePeerDependencies: - '@vue/composition-api' @@ -8933,7 +8933,7 @@ packages: resolution: {integrity: sha512-rN2qd22AUl7VdBxihagWyhUNHCyVk9IpvBTTfHoLH9G7rGE552X1f+zeCfehuno0zXif13jPw+icW/wn2a0rnQ==} peerDependencies: '@vue/composition-api': ^1.1.0 - vue: ^2.6.0 || ^3.2.0 + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -9444,7 +9444,7 @@ packages: resolution: {integrity: sha512-QKCAcOY5EJF0PepiVGA4X5PzUetYUvG5qALmA+2TON40pc2+brOEiVTwr3kjF9N+f7q4MpyiLPu4pIErwoajOQ==} engines: {node: '>=12.22.0'} peerDependencies: - vue: '>=3.2.0' + vue: latest dependencies: '@ant-design/colors': 6.0.0 '@ant-design/icons-vue': 6.1.0(vue@3.3.4) @@ -12107,7 +12107,7 @@ packages: /emoji-mart-vue-fast@15.0.0(vue@3.3.4): resolution: {integrity: sha512-3BzkDrs60JyT00dLHMAxWKbpFhbyaW9C+q1AjtqGovSxTu8TC2mYAGsvTmXNYKm39IRRAS56v92TihOcB98IsQ==} peerDependencies: - vue: '>2.0.0' + vue: latest dependencies: '@babel/runtime': 7.22.11 core-js: 3.32.1 @@ -12558,7 +12558,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.33.0)(typescript@5.2.2) + '@typescript-eslint/parser': 5.62.0(eslint@8.33.0) debug: 3.2.7(supports-color@5.5.0) eslint: 8.33.0 eslint-import-resolver-node: 0.3.9 @@ -12624,7 +12624,7 @@ packages: - supports-color dev: true - /eslint-plugin-antfu@0.26.0(eslint@8.33.0)(typescript@5.2.2): + /eslint-plugin-antfu@0.26.0(eslint@8.33.0): resolution: {integrity: sha512-hc5Bb6EH6zM/Vjy0scOQydlG9I1DDocG4AikyUfqjSFneWv6eNItej9LHYTXEGc0iGosCysNS4tPUAPuhBHkCA==} dependencies: '@typescript-eslint/utils': 5.62.0(eslint@8.33.0)(typescript@5.2.2) @@ -12661,7 +12661,7 @@ packages: engines: {node: '>=16.10.0'} peerDependencies: eslint: ^8.0.0 - typescript: '>=4.0.2' + typescript: latest peerDependenciesMeta: typescript: optional: true @@ -12760,7 +12760,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.33.0)(typescript@5.2.2) + '@typescript-eslint/parser': 5.62.0(eslint@8.33.0) array-includes: 3.1.6 array.prototype.findlastindex: 1.2.2 array.prototype.flat: 1.3.1 @@ -13674,7 +13674,7 @@ packages: resolution: {integrity: sha512-mX3qW3idpueT2klaQXBzrIM/pHw+T0B/V9KHEvNrqijTq9NFnMZU6oreVxDYcf33P8a5cW+67PjodNHthGnNVg==} engines: {node: '>=12.13.0', yarn: '>=1.0.0'} peerDependencies: - typescript: '>3.6.0' + typescript: latest webpack: ^5.11.0 dependencies: '@babel/code-frame': 7.22.10 @@ -15071,6 +15071,11 @@ packages: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} + /ipaddr.js@2.1.0: + resolution: {integrity: sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==} + engines: {node: '>= 10'} + dev: false + /ipx@1.2.0: resolution: {integrity: sha512-FkEP56C08HdlqlWKm3pMhatywPtDBTlePTdzskksCR1+7xnB6fQs6pXOTXPTG5i+gGPgCOxbNMUSZEH/DQcWDA==} hasBin: true @@ -15259,7 +15264,7 @@ packages: resolution: {integrity: sha512-DDx04RjLpGNT4vtF49vGW5CECP6lAx8SL2keq99ogIxwLvJPBvgThdhb43ED5uYO4nq0kZ51tMj7VdCCQgdZ5Q==} peerDependencies: eslint: '*' - typescript: '>=4.7.4' + typescript: latest dependencies: '@typescript-eslint/type-utils': 5.62.0(eslint@8.33.0)(typescript@5.2.2) eslint: 8.33.0 @@ -18312,7 +18317,7 @@ packages: - vite dev: true - /nuxt@3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(typescript@5.2.2): + /nuxt@3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4): resolution: {integrity: sha512-0A7V8B1HrIXX9IlqPc2w+5ZPXi+7MYa9QVhtuGYuLvjRKoSFANhCoMPRP6pKdoxigM1MBxhLue2VmHA/VbtJCw==} engines: {node: ^14.18.0 || >=16.10.0} hasBin: true @@ -18328,7 +18333,7 @@ packages: '@nuxt/schema': 3.6.5 '@nuxt/telemetry': 2.4.1 '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(typescript@5.2.2)(vue@3.3.4) + '@nuxt/vite-builder': 3.6.5(@types/node@20.3.1)(eslint@8.33.0)(sass@1.63.4)(vue@3.3.4) '@types/node': 20.3.1 '@unhead/ssr': 1.3.9 '@unhead/vue': 1.3.9(vue@3.3.4) @@ -19202,12 +19207,12 @@ packages: engines: {node: '>=10'} dev: true - /pinia@2.1.4(typescript@5.2.2)(vue@3.3.4): + /pinia@2.1.4(vue@3.3.4): resolution: {integrity: sha512-vYlnDu+Y/FXxv1ABo1vhjC+IbqvzUdiUC3sfDRrRyY2CQSrqqaa+iiHmqtARFxJVqWQMCJfXx1PBvFs9aJVLXQ==} peerDependencies: '@vue/composition-api': ^1.4.0 - typescript: '>=4.4.4' - vue: ^2.6.14 || ^3.3.0 + typescript: latest + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -19215,7 +19220,6 @@ packages: optional: true dependencies: '@vue/devtools-api': 6.5.0 - typescript: 5.2.2 vue: 3.3.4 vue-demi: 0.14.5(vue@3.3.4) dev: false @@ -20181,6 +20185,12 @@ packages: engines: {node: '>=0.10'} dev: true + /request-filtering-agent@1.1.2: + resolution: {integrity: sha512-v6uYIoey6rhe+nQXB5rlYEWJI+5SrnvM72XGeLUsykzu2omOEPoW4QmzEH+8/sheK4M/hwQ85L7aPj1cTJfPLg==} + dependencies: + ipaddr.js: 2.1.0 + dev: false + /request-ip@2.1.3: resolution: {integrity: sha512-J3qdE/IhVM3BXkwMIVO4yFrvhJlU3H7JH16+6yHucadT4fePnR8dyh+vEs6FIx0S2x5TCt2ptiPfHcn0sqhbYQ==} dependencies: @@ -21990,7 +22000,7 @@ packages: resolution: {integrity: sha512-Cbu4nIqnEdd+THNEsBdkolnOXhg0I8XteoHaEKgvsxpsbWda4IsUut2c187HxywQCvveojow0Dgw/amxtSKVkQ==} engines: {node: '>=16.13.0'} peerDependencies: - typescript: '>=4.2.0' + typescript: latest dependencies: typescript: 5.2.2 dev: true @@ -22010,7 +22020,7 @@ packages: babel-jest: ^29.0.0 esbuild: '*' jest: ^29.0.0 - typescript: '>=4.3' + typescript: latest peerDependenciesMeta: '@babel/core': optional: true @@ -22038,7 +22048,7 @@ packages: resolution: {integrity: sha512-MLukxDHBl8OJ5Dk3y69IsKVFRA/6MwzEqBgh+OXMPB/OD01KQuWPFd1WAQP8a5PeSCAxfnkhiuWqfmFJzJQt9w==} engines: {node: '>=12.0.0'} peerDependencies: - typescript: '*' + typescript: latest webpack: ^5.0.0 dependencies: chalk: 4.1.2 @@ -22046,6 +22056,20 @@ packages: micromatch: 4.0.5 semver: 7.5.4 typescript: 5.2.2 + webpack: 5.88.2(webpack-cli@5.1.4) + dev: true + + /ts-loader@9.4.4(webpack@5.88.2): + resolution: {integrity: sha512-MLukxDHBl8OJ5Dk3y69IsKVFRA/6MwzEqBgh+OXMPB/OD01KQuWPFd1WAQP8a5PeSCAxfnkhiuWqfmFJzJQt9w==} + engines: {node: '>=12.0.0'} + peerDependencies: + typescript: latest + webpack: ^5.0.0 + dependencies: + chalk: 4.1.2 + enhanced-resolve: 5.15.0 + micromatch: 4.0.5 + semver: 7.5.4 webpack: 5.88.2(esbuild@0.19.2) dev: true @@ -22070,7 +22094,7 @@ packages: '@swc/core': '>=1.2.50' '@swc/wasm': '>=1.2.50' '@types/node': '*' - typescript: '>=2.7' + typescript: latest peerDependenciesMeta: '@swc/core': optional: true @@ -22160,7 +22184,7 @@ packages: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: - typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' + typescript: latest dependencies: tslib: 1.14.1 typescript: 5.2.2 @@ -22318,6 +22342,7 @@ packages: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true + dev: true /ufo@1.3.0: resolution: {integrity: sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==} @@ -22579,7 +22604,7 @@ packages: engines: {node: '>=14'} peerDependencies: '@babel/parser': ^7.15.8 - vue: 2 || 3 + vue: latest peerDependenciesMeta: '@babel/parser': optional: true @@ -22932,7 +22957,7 @@ packages: - terser dev: true - /vite-plugin-checker@0.6.2(eslint@8.33.0)(typescript@5.2.2)(vite@4.3.9): + /vite-plugin-checker@0.6.2(eslint@8.33.0)(vite@4.3.9): resolution: {integrity: sha512-YvvvQ+IjY09BX7Ab+1pjxkELQsBd4rPhWNw8WLBeFVxu/E7O+n6VYAqNsKdK/a2luFlX/sMpoWdGFfg4HvwdJQ==} engines: {node: '>=14.16'} peerDependencies: @@ -22940,7 +22965,7 @@ packages: meow: ^9.0.0 optionator: ^0.9.1 stylelint: '>=13' - typescript: '*' + typescript: latest vite: '>=2.0.0' vls: '*' vti: '*' @@ -22977,7 +23002,6 @@ packages: semver: 7.5.4 strip-ansi: 6.0.1 tiny-invariant: 1.3.1 - typescript: 5.2.2 vite: 4.3.9(@types/node@20.3.1)(sass@1.63.4) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 @@ -23236,7 +23260,7 @@ packages: resolution: {integrity: sha512-d3zpKmGZr2OWHQ1xmxBcAn5ShTG917+/UCLaSpaCDDqT0U7DBsvFzTs69ZnHCgKoXT55GZDW8YEj9Av+dlONLA==} peerDependencies: chart.js: ^4.1.1 - vue: ^3.0.0-0 || ^2.7.0 + vue: latest dependencies: chart.js: 4.3.0 vue: 3.3.4 @@ -23249,7 +23273,7 @@ packages: requiresBuild: true peerDependencies: '@vue/composition-api': ^1.0.0-rc.1 - vue: ^3.0.0-0 || ^2.6.0 + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -23264,7 +23288,7 @@ packages: requiresBuild: true peerDependencies: '@vue/composition-api': ^1.0.0-rc.1 - vue: ^3.0.0-0 || ^2.6.0 + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -23278,7 +23302,7 @@ packages: requiresBuild: true peerDependencies: '@vue/composition-api': ^1.0.0-rc.1 - vue: ^3.0.0-0 || ^2.6.0 + vue: latest peerDependenciesMeta: '@vue/composition-api': optional: true @@ -23292,7 +23316,7 @@ packages: /vue-dompurify-html@3.0.0(vue@3.3.4): resolution: {integrity: sha512-S6PMeJU7S3w0TnxMWWd4iydc7oPdOER1GmW9rsgiRwHvcw+nUi2v6BgERcFBULlM+x6PXsfu5P/Rm4reVvWH5A==} peerDependencies: - vue: ^3.0.0 + vue: latest dependencies: dompurify: 2.4.7 vue: 3.3.4 @@ -23326,7 +23350,7 @@ packages: resolution: {integrity: sha512-yswpwtj89rTBhegUAv9Mu37LNznyu3NpyLQmozF3i1hYOhwpG8RjcjIFIIfnu+2MDZJGSZPXaKWvnQA71Yv9TQ==} engines: {node: '>= 14'} peerDependencies: - vue: ^3.0.0 + vue: latest dependencies: '@intlify/core-base': 9.2.2 '@intlify/shared': 9.2.2 @@ -23348,7 +23372,7 @@ packages: /vue-router@4.2.4(vue@3.3.4): resolution: {integrity: sha512-9PISkmaCO02OzPVOMq2w82ilty6+xJmQrarYZDkjZBfl4RvYAlt4PKnEX21oW4KTtWfa9OuO/b3qk1Od3AEdCQ==} peerDependencies: - vue: ^3.2.0 + vue: latest dependencies: '@vue/devtools-api': 6.5.0 vue: 3.3.4 @@ -23358,7 +23382,7 @@ packages: resolution: {integrity: sha512-IwUC0Aq2zwaXqy74h4WCvFCUtoV0iSWr0snWnE9TnU18S66GAQyqQbRf2qfJtUuiFsBf6qp0MEwdonlwznlcrw==} engines: {node: '>=10.15.0'} peerDependencies: - vue: ^3.0.0 + vue: latest dependencies: is-plain-object: 3.0.1 vue: 3.3.4 @@ -23368,7 +23392,7 @@ packages: resolution: {integrity: sha512-BchyC33WiZryYatFINj3LWqgyE6X82Huzf7abA23tsF/IbaRZVwZzie8SmGaYvezEBiPXhJogQ3dtxIuXFjkBw==} engines: {node: '>=12'} peerDependencies: - vue: ^3.2.24 + vue: latest dependencies: tippy.js: 6.3.7 vue: 3.3.4 @@ -23403,7 +23427,7 @@ packages: resolution: {integrity: sha512-l/30RvXLkw50axAjswAK1DmvbUc5Oyhq9GkvD98p8pykrLkIajRi3evVsMnahMBK0O7+EGIK9RbIOKPyRfuw7w==} peerDependencies: resize-detector: ^0.3.0 - vue: ^3.2.37 + vue: latest dependencies: resize-detector: 0.3.0 vue: 3.3.4 @@ -23421,7 +23445,7 @@ packages: /vuedraggable@4.1.0(vue@3.3.4): resolution: {integrity: sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==} peerDependencies: - vue: ^3.0.1 + vue: latest dependencies: sortablejs: 1.14.0 vue: 3.3.4 From 180add5e3b04faa6b62d235f852e2ae66a55f8fe Mon Sep 17 00:00:00 2001 From: sreehari jayaraj Date: Fri, 6 Oct 2023 18:42:07 +0530 Subject: [PATCH 06/58] fix: css refactor --- packages/nc-gui/components/account/Token.vue | 14 +- .../nc-gui/components/account/UserList.vue | 212 +++++++++--------- 2 files changed, 116 insertions(+), 110 deletions(-) diff --git a/packages/nc-gui/components/account/Token.vue b/packages/nc-gui/components/account/Token.vue index 8b0b84c1fd..14f36989cc 100644 --- a/packages/nc-gui/components/account/Token.vue +++ b/packages/nc-gui/components/account/Token.vue @@ -161,7 +161,7 @@ const handleCancel = () => { diff --git a/packages/nc-gui/components/nc/Tooltip.vue b/packages/nc-gui/components/nc/Tooltip.vue index 0810b8b3ab..97b159e4a9 100644 --- a/packages/nc-gui/components/nc/Tooltip.vue +++ b/packages/nc-gui/components/nc/Tooltip.vue @@ -12,6 +12,7 @@ interface Props { disabled?: boolean placement?: TooltipPlacement | undefined hideOnClick?: boolean + overlayClassName?: string } const props = defineProps() @@ -36,6 +37,8 @@ const attrs = useAttrs() const isKeyPressed = ref(false) +const overlayClassName = computed(() => props.overlayClassName) + onKeyStroke( (e) => e.key === modifierKey.value, (e) => { @@ -100,7 +103,7 @@ const onClick = () => { - diff --git a/packages/nc-gui/components/account/UserList.vue b/packages/nc-gui/components/account/UserList.vue index b50ab7dd0b..b9082d5b8e 100644 --- a/packages/nc-gui/components/account/UserList.vue +++ b/packages/nc-gui/components/account/UserList.vue @@ -185,7 +185,7 @@ const openDeleteModal = (user: UserType) => {
-
+
{ 'py-4': el.roles?.includes('super'), }" > - - {{ el.email }} + + + {{ el.email }} +
{{ $t('labels.superAdmin') }}
- { {{ $t('msg.info.roles.orgViewer') }}
- +
- +
- + + + +