Skip to content

Commit

Permalink
feat: Add community metadata validation
Browse files Browse the repository at this point in the history
Validate that the community metadata is only written to by the owner
and refactor it into it's own store class.
  • Loading branch information
Lucas Leblow committed Nov 29, 2023
1 parent faca03b commit d1291fa
Show file tree
Hide file tree
Showing 49 changed files with 3,023 additions and 1,872 deletions.
3,599 changes: 2,180 additions & 1,419 deletions packages/backend/package-lock.json

Large diffs are not rendered by default.

291 changes: 146 additions & 145 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,147 +1,148 @@
{
"name": "@quiet/backend",
"version": "2.0.3-alpha.5",
"description": "tlg-manager",
"types": "lib/index.d.ts",
"type": "module",
"exports": "lib/index.js",
"author": "",
"license": "MIT",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
"webpack": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"webpack:prod": "webpack --env mode=production && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"applyPatches": "patch -f -p0 < ./electron-fetch.patch || true && patch -f -p0 --forward --binary < ./parse-duration.patch || true && patch -f -p0 --forward --binary < ./parse-duration-esm.patch || true",
"prepare": "npm run applyPatches && npm run webpack",
"version": "git add -A src",
"lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix",
"lint-ci": "eslint --ext .jsx,.js,.ts,.tsx ./src/",
"test-nest": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js --detectOpenHandles --forceExit ./src/nest/**/*.spec.ts",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js ./src/**/* --runInBand --verbose --testPathIgnorePatterns=\".src/(!?nodeTest*)|(.node_modules*)\"",
"test-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/**/* --runInBand --colors --ci --silent --verbose --testPathIgnorePatterns=\".src/nest/(!?nodeTest*)|(.node_modules*)|src/nest/.*\\.tor.spec\\.(t|j)s|src/nest/ipfs-file-manager/big-files.long.spec.ts$\"",
"test-ci-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --colors --ci --silent --verbose --detectOpenHandles --forceExit ./src/nest/**/*.tor.spec.ts",
"test-ci-long-running": "cross-env DEBUG=backend:* NODE_OPTIONS=--experimental-vm-modules jest --colors --ci --verbose ./src/nest/**/*.long.spec.ts",
"test-connect": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG='libp2p:websockets*' jest ./src/nodeTest/* --verbose",
"test-connect-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/nodeTest/* --colors --ci --silent --verbose",
"test-replication-no-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules ts-node -v && cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 200 --entriesCount 1000 --no-useTor",
"test-replication-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 500 --entriesCount 1000 --useTor",
"rmDist": "rimraf lib/"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]:TryQuiet/backend.git"
},
"files": [
"lib/**/*",
"package-lock.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
"clearMocks": true,
"coverageProvider": "v8",
"transformIgnorePatterns": [
"node_modules/(?!p-defer|peer-id)"
],
"testTimeout": 40000,
"setupFiles": [
"./jestSetup.js"
],
"testEnvironment": "jest-environment-node"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@quiet/eslint-config": "^2.0.2-alpha.0",
"@quiet/state-manager": "^2.0.2-alpha.3",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.9",
"@types/jest": "28.1.8",
"@types/luxon": "^3.3.0",
"@types/mock-fs": "^4.13.1",
"@types/node": "18.11.9",
"@types/node-fetch": "^2.5.11",
"@types/orbit-db": "git+https://github.com/orbitdb/orbit-db-types.git",
"@types/supertest": "^2.0.11",
"@types/tmp": "^0.2.3",
"@types/validator": "^13.11.5",
"@types/ws": "8.5.3",
"babel-jest": "^29.3.1",
"cross-env": "^5.2.0",
"fetch-mock-jest": "^1.5.1",
"jest": "^29.4.2",
"mock-fs": "^5.1.2",
"tmp": "^0.2.1",
"ts-jest": "^29.0.3",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"typescript": "^4.9.3",
"wait-for-expect": "^3.0.2",
"webpack": "5.75.0",
"webpack-cli": "5.0.1",
"yargs": "^17.1.0"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "6.1.0",
"@chainsafe/libp2p-noise": "11.0.0",
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@peculiar/webcrypto": "1.4.3",
"@quiet/common": "^2.0.2-alpha.1",
"@quiet/identity": "^2.0.2-alpha.2",
"@quiet/logger": "^2.0.2-alpha.0",
"@quiet/types": "^2.0.2-alpha.1",
"abortable-iterator": "^3.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.1",
"cli-table": "^0.3.6",
"commander": "^7.2.0",
"cors": "^2.8.5",
"crypto-js": "^4.1.1",
"debug": "^4.3.1",
"dotenv": "8.2.0",
"events": "^3.2.0",
"express": "^4.17.1",
"get-port": "^5.1.1",
"go-ipfs": "npm:[email protected]",
"http-server": "^0.12.3",
"https-proxy-agent": "^5.0.0",
"image-size": "^1.0.1",
"ipfs": "0.66.0",
"ipfs-log": "^5.4.2",
"it-ws": "5.0.6",
"joi": "^17.8.1",
"level": "8.0.0",
"libp2p": "0.42.2",
"luxon": "^1.11.4",
"multiaddr": "^10.0.1",
"orbit-db": "0.29.0",
"orbit-db-access-controllers": "^0.4.0",
"orbit-db-identity-provider": "0.5.0",
"orbit-db-io": "1.0.2",
"orbit-db-pubsub": "0.6.0",
"orbit-db-store": "4.3.4",
"p-queue": "7.3.4",
"peer-id": "^0.16.0",
"pkijs": "3.0.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"secp256k1": "4.0.3",
"socket.io": "4.6.0",
"socks-proxy-agent": "^5.0.0",
"string-replace-loader": "3.1.0",
"ts-jest-resolver": "^2.0.0",
"validator": "^13.11.0"
},
"overrides": {
"level": "$level",
"leveldown": "^6",
"go-ipfs": "npm:[email protected]",
"orbit-db": {
"ipfs-pubsub-peer-monitor": "vinkabuki/ipfs-pubsub-peer-monitor#038af76f22e6c902dab4a855b24273707ce17d94"
}
}
"name": "@quiet/backend",
"version": "2.0.3-alpha.5",
"description": "tlg-manager",
"types": "lib/index.d.ts",
"type": "module",
"exports": "lib/index.js",
"author": "",
"license": "MIT",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
"webpack": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"webpack:prod": "webpack --env mode=production && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"applyPatches": "patch -f -p0 < ./electron-fetch.patch || true && patch -f -p0 --forward --binary < ./parse-duration.patch || true && patch -f -p0 --forward --binary < ./parse-duration-esm.patch || true",
"prepare": "npm run applyPatches && npm run webpack",
"version": "git add -A src",
"lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix",
"lint-ci": "eslint --ext .jsx,.js,.ts,.tsx ./src/",
"test-nest": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js --detectOpenHandles --forceExit ./src/nest/**/*.spec.ts",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js ./src/**/* --runInBand --verbose --testPathIgnorePatterns=\".src/(!?nodeTest*)|(.node_modules*)\"",
"test-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/**/* --runInBand --colors --ci --silent --verbose --testPathIgnorePatterns=\".src/nest/(!?nodeTest*)|(.node_modules*)|src/nest/.*\\.tor.spec\\.(t|j)s|src/nest/ipfs-file-manager/big-files.long.spec.ts$\"",
"test-it": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js --runInBand --verbose --testPathIgnorePatterns=\".src/(!?nodeTest*)|(.node_modules*)\" --",
"test-ci-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --colors --ci --silent --verbose --detectOpenHandles --forceExit ./src/nest/**/*.tor.spec.ts",
"test-ci-long-running": "cross-env DEBUG=backend:* NODE_OPTIONS=--experimental-vm-modules jest --colors --ci --verbose ./src/nest/**/*.long.spec.ts",
"test-connect": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG='libp2p:websockets*' jest ./src/nodeTest/* --verbose",
"test-connect-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/nodeTest/* --colors --ci --silent --verbose",
"test-replication-no-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules ts-node -v && cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 200 --entriesCount 1000 --no-useTor",
"test-replication-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 500 --entriesCount 1000 --useTor",
"rmDist": "rimraf lib/"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]:TryQuiet/backend.git"
},
"files": [
"lib/**/*",
"package-lock.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
"clearMocks": true,
"coverageProvider": "v8",
"transformIgnorePatterns": [
"node_modules/(?!p-defer|peer-id)"
],
"testTimeout": 40000,
"setupFiles": [
"./jestSetup.js"
],
"testEnvironment": "jest-environment-node"
},
"devDependencies": {
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.10",
"@quiet/eslint-config": "^2.0.2-alpha.0",
"@quiet/state-manager": "^2.0.2-alpha.3",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.9",
"@types/jest": "28.1.8",
"@types/luxon": "^3.3.0",
"@types/mock-fs": "^4.13.1",
"@types/node": "18.11.9",
"@types/node-fetch": "^2.5.11",
"@types/orbit-db": "git+https://github.com/orbitdb/orbit-db-types.git",
"@types/supertest": "^2.0.11",
"@types/tmp": "^0.2.3",
"@types/validator": "^13.11.5",
"@types/ws": "8.5.3",
"babel-jest": "^29.3.1",
"cross-env": "^5.2.0",
"fetch-mock-jest": "^1.5.1",
"jest": "^29.4.2",
"mock-fs": "^5.1.2",
"tmp": "^0.2.1",
"ts-jest": "^29.0.3",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"typescript": "^4.9.3",
"wait-for-expect": "^3.0.2",
"webpack": "5.75.0",
"webpack-cli": "5.0.1",
"yargs": "^17.1.0"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "6.1.0",
"@chainsafe/libp2p-noise": "11.0.0",
"@nestjs/common": "^10.2.10",
"@nestjs/core": "^10.2.10",
"@nestjs/platform-express": "^10.2.10",
"@peculiar/webcrypto": "1.4.3",
"@quiet/common": "^2.0.2-alpha.1",
"@quiet/identity": "^2.0.2-alpha.2",
"@quiet/logger": "^2.0.2-alpha.0",
"@quiet/types": "^2.0.2-alpha.1",
"abortable-iterator": "^3.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.1",
"cli-table": "^0.3.6",
"commander": "^7.2.0",
"cors": "^2.8.5",
"crypto-js": "^4.1.1",
"debug": "^4.3.1",
"dotenv": "8.2.0",
"events": "^3.2.0",
"express": "^4.17.1",
"get-port": "^5.1.1",
"go-ipfs": "npm:[email protected]",
"http-server": "^0.12.3",
"https-proxy-agent": "^5.0.0",
"image-size": "^1.0.1",
"ipfs": "0.66.0",
"ipfs-log": "^5.4.2",
"it-ws": "5.0.6",
"joi": "^17.8.1",
"level": "8.0.0",
"libp2p": "0.42.2",
"luxon": "^1.11.4",
"multiaddr": "^10.0.1",
"orbit-db": "0.29.0",
"orbit-db-access-controllers": "^0.4.0",
"orbit-db-identity-provider": "0.5.0",
"orbit-db-io": "1.0.2",
"orbit-db-pubsub": "0.6.0",
"orbit-db-store": "4.3.4",
"p-queue": "7.3.4",
"peer-id": "^0.16.0",
"pkijs": "3.0.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"secp256k1": "4.0.3",
"socket.io": "4.6.0",
"socks-proxy-agent": "^5.0.0",
"string-replace-loader": "3.1.0",
"ts-jest-resolver": "^2.0.0",
"validator": "^13.11.0"
},
"overrides": {
"level": "$level",
"leveldown": "^6",
"go-ipfs": "npm:[email protected]",
"orbit-db": {
"ipfs-pubsub-peer-monitor": "vinkabuki/ipfs-pubsub-peer-monitor#038af76f22e6c902dab4a855b24273707ce17d94"
}
}
}
3 changes: 1 addition & 2 deletions packages/backend/src/backendManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export const runBackendDesktop = async () => {
appDataPath: path.join(options.appDataPath.trim(), 'Quiet'),
},
},
}),
{ logger: false }
})
)

const connectionsManager = app.get<ConnectionsManagerService>(ConnectionsManagerService)
Expand Down
Loading

0 comments on commit d1291fa

Please sign in to comment.