diff --git a/.github/secrets/decrypt_secrets.sh b/.github/secrets/decrypt_secrets.sh index e63edf9a6a..19dfa83dc7 100755 --- a/.github/secrets/decrypt_secrets.sh +++ b/.github/secrets/decrypt_secrets.sh @@ -1,11 +1,13 @@ #!/bin/sh +set -e + gpg --quiet --batch --yes --decrypt --passphrase="$IOS_PROFILE_KEY" --output ./.github/secrets/match_AppStore_comquietmobile.mobileprovision ./.github/secrets/match_AppStore_comquietmobile.mobileprovision.gpg gpg --quiet --batch --yes --decrypt --passphrase="$IOS_CERTIFICATE_KEY" --output ./.github/secrets/Certificates.p12 ./.github/secrets/Certificates.p12.gpg mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles -cp ./.github/secrets/match_AppStore_comquietmobile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/654a2214-095f-4939-a9e5-09f7a2ccf530.mobileprovision +cp ./.github/secrets/match_AppStore_comquietmobile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/718ac015-309f-49b6-9653-f6cf84a6377c.mobileprovision security create-keychain -p "" build.keychain @@ -17,4 +19,3 @@ security unlock-keychain -p "" ~/Library/Keychains/build.keychain security set-keychain-settings ~/Library/Keychains/build.keychain #this removes autolock security set-key-partition-list -S apple-tool:,apple: -s -k "" ~/Library/Keychains/build.keychain - diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 12a1ecdbf3..c00e7a14a1 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -25,7 +25,7 @@ jobs: CHECKSUM_PATH: ${{ github.event.action == 'released' && 'packages/desktop/dist/latest-linux.yml' || 'packages/desktop/dist/alpha-linux.yml' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup environment uses: ./.github/actions/setup-env @@ -96,7 +96,7 @@ jobs: S3_BUCKET: ${{ github.event.action == 'released' && 'quiet' || 'test.quiet' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/components-nightly@v1 with: @@ -169,7 +169,7 @@ jobs: S3_BUCKET: ${{ github.event.action == 'released' && 'quiet' || 'test.quiet' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Fetch jsign" shell: bash diff --git a/.github/workflows/check-visual-regression.yml b/.github/workflows/check-visual-regression.yml index dae9c165b4..dcdd1ae1d1 100644 --- a/.github/workflows/check-visual-regression.yml +++ b/.github/workflows/check-visual-regression.yml @@ -17,7 +17,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Required to retrieve git history diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f10ae5150a..d4bb407c58 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -16,7 +16,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Remove test files workaround (jest types conflicting with cypress types)" if: ${{ runner.os == 'Windows' }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 090aaa8b24..07ee9e671c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -41,11 +41,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4 + uses: github/codeql-action/init@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -55,7 +55,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4 + uses: github/codeql-action/autobuild@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -68,6 +68,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4 + uses: github/codeql-action/analyze@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9 with: category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/depencency-review.yml b/.github/workflows/depencency-review.yml index b0fb203339..7989380270 100644 --- a/.github/workflows/depencency-review.yml +++ b/.github/workflows/depencency-review.yml @@ -17,6 +17,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: 'Dependency Review' - uses: actions/dependency-review-action@6c5ccdad469c9f8a2996bfecaec55a631a347034 # v3.1.0 \ No newline at end of file + uses: actions/dependency-review-action@6c5ccdad469c9f8a2996bfecaec55a631a347034 # v3.1.0 diff --git a/.github/workflows/deploy-android.yaml b/.github/workflows/deploy-android.yaml index 192e83131a..2ed25b3df4 100644 --- a/.github/workflows/deploy-android.yaml +++ b/.github/workflows/deploy-android.yaml @@ -19,7 +19,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Set up JDK" uses: actions/setup-java@v3 diff --git a/.github/workflows/deploy-ios.yml b/.github/workflows/deploy-ios.yml index cab540230a..98bd9caee7 100644 --- a/.github/workflows/deploy-ios.yml +++ b/.github/workflows/deploy-ios.yml @@ -19,7 +19,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: lfs: true @@ -57,7 +57,7 @@ jobs: -scheme Quiet \ -configuration Release \ -archivePath build/Quiet.xcarchive \ - PROVISIONING_PROFILE="654a2214-095f-4939-a9e5-09f7a2ccf530" \ + PROVISIONING_PROFILE="718ac015-309f-49b6-9653-f6cf84a6377c" \ CODE_SIGN_IDENTITY="Apple Distribution: Zbay LLC (CTYKSWN9T4)" - name: Export .ipa diff --git a/.github/workflows/e2e-linux.yml b/.github/workflows/e2e-linux.yml index 779cdfb836..0777003d85 100644 --- a/.github/workflows/e2e-linux.yml +++ b/.github/workflows/e2e-linux.yml @@ -18,7 +18,7 @@ jobs: TEST_MODE: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install WM run: sudo apt install fluxbox @@ -53,12 +53,12 @@ jobs: max_attempts: 3 command: cd packages/e2e-tests && npm run test oneClient.test.ts - - name: Run two clients test + - name: Run multiple clients test uses: nick-fields/retry@v2 with: timeout_minutes: 25 max_attempts: 3 - command: cd packages/e2e-tests && npm run test twoClients.test.ts + command: cd packages/e2e-tests && npm run test multipleClients.test.ts - name: Run invitation link test - Includes 2 separate application clients uses: nick-fields/retry@v2 diff --git a/.github/workflows/e2e-mac.yml b/.github/workflows/e2e-mac.yml index 69df3d5d74..6f0483f752 100644 --- a/.github/workflows/e2e-mac.yml +++ b/.github/workflows/e2e-mac.yml @@ -11,7 +11,7 @@ jobs: IS_E2E: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env @@ -61,11 +61,11 @@ jobs: max_attempts: 3 command: cd packages/e2e-tests && npm run test oneClient.test.ts - - name: Run two clients test + - name: Run multiple clients test uses: nick-fields/retry@v2 with: timeout_minutes: 25 max_attempts: 3 - command: cd packages/e2e-tests && npm run test twoClients.test.ts + command: cd packages/e2e-tests && npm run test multipleClients.test.ts diff --git a/.github/workflows/e2e-win.yml b/.github/workflows/e2e-win.yml index 12d617de4c..100e13d4f0 100644 --- a/.github/workflows/e2e-win.yml +++ b/.github/workflows/e2e-win.yml @@ -13,7 +13,7 @@ jobs: E2E: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env @@ -68,11 +68,11 @@ jobs: shell: powershell - name: Kill Quiet - run: Stop-Process -Name "Quiet" -Force + run: Get-Process -Name "Quiet" -ErrorAction SilentlyContinue | Stop-Process -Force shell: powershell - name: Kill tor - run: Stop-Process -Name "tor" -Force + run: Get-Process -Name "tor" -ErrorAction SilentlyContinue | Stop-Process -Force shell: powershell - name: Delay @@ -87,13 +87,13 @@ jobs: shell: bash command: cd packages/e2e-tests && npm run test oneClient.test.ts - - name: Run two clients test + - name: Run multiple clients test uses: nick-fields/retry@v2 with: timeout_minutes: 30 max_attempts: 3 shell: bash - command: cd packages/e2e-tests && npm run test twoClients.test.ts + command: cd packages/e2e-tests && npm run test multipleClients.test.ts - name: Run invitation link test - Includes 2 separate application clients uses: nick-fields/retry@v2 diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml index 9fdf6487cb..aaf54dd035 100644 --- a/.github/workflows/frontend-tests.yml +++ b/.github/workflows/frontend-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/identity-tests.yml b/.github/workflows/identity-tests.yml index a553775f8c..033308b099 100644 --- a/.github/workflows/identity-tests.yml +++ b/.github/workflows/identity-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ed217a897e..18680ddb4f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -20,7 +20,7 @@ jobs: - name: 'Print OS' run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/mobile-tests.yml b/.github/workflows/mobile-tests.yml index cd57d786f3..46f8ba291c 100644 --- a/.github/workflows/mobile-tests.yml +++ b/.github/workflows/mobile-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup environment uses: ./.github/actions/setup-env diff --git a/.github/workflows/nectar-tests.yml b/.github/workflows/nectar-tests.yml index 2eea110f1d..b9bb196580 100644 --- a/.github/workflows/nectar-tests.yml +++ b/.github/workflows/nectar-tests.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/.github/workflows/regression-test.yml b/.github/workflows/regression-test.yml index 1df9b377dd..581c0a0b37 100644 --- a/.github/workflows/regression-test.yml +++ b/.github/workflows/regression-test.yml @@ -18,7 +18,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup environment uses: ./.github/actions/setup-env @@ -31,7 +31,7 @@ jobs: - name: "Remove test files workaround" run: find packages/desktop/src -name '*.test.*' -delete && find packages/backend/src -name '*.test.*' -delete - - uses: cypress-io/github-action@v2 + - uses: cypress-io/github-action@v6 with: install: false command: npm run regression-test:ci diff --git a/.github/workflows/waggle-tests.yml b/.github/workflows/waggle-tests.yml index 3bf08f322d..1f41fdd237 100644 --- a/.github/workflows/waggle-tests.yml +++ b/.github/workflows/waggle-tests.yml @@ -17,7 +17,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env @@ -38,7 +38,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env @@ -59,7 +59,7 @@ jobs: - name: "Print OS" run: echo ${{ matrix.os }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Setup environment" uses: ./.github/actions/setup-env diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a4b9c853..856c4228ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + [unreleased] * UI layer for taken usernames for desktop and mobile @@ -8,6 +9,8 @@ * Update registrar service to match new registration flow. +* Add possible impersonation attack UI for desktop and mobile + * Fix truncated long messages in channelInput component * Unblock mobile e2e tests @@ -16,6 +19,8 @@ * Running Chromatic tests for forked PRs +* Added e2e test for user joining community when owner is offline. Improved e2e tests + * Bump github actions/* to versions using node16 * Project can now be bootstraped on Windows (powershell) diff --git a/packages/backend-bundle/CHANGELOG.md b/packages/backend-bundle/CHANGELOG.md index 043453cbc1..9f7d1f06f0 100644 --- a/packages/backend-bundle/CHANGELOG.md +++ b/packages/backend-bundle/CHANGELOG.md @@ -20,6 +20,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline # [1.7.0-alpha.0](/compare/backend-bundle@1.6.0...backend-bundle@1.7.0-alpha.0) (2023-08-29) +## [1.6.1](https://github.com/TryQuiet/quiet/compare/backend-bundle@1.6.0...backend-bundle@1.6.1) (2023-09-25) **Note:** Version bump only for package backend-bundle diff --git a/packages/backend-bundle/package-lock.json b/packages/backend-bundle/package-lock.json index 4f5e0be28f..6ccc8b32b6 100644 --- a/packages/backend-bundle/package-lock.json +++ b/packages/backend-bundle/package-lock.json @@ -10,4 +10,4 @@ "license": "ISC" } } -} +} \ No newline at end of file diff --git a/packages/backend-bundle/package.json b/packages/backend-bundle/package.json index e8fa9798f3..a2f5ec99b6 100644 --- a/packages/backend-bundle/package.json +++ b/packages/backend-bundle/package.json @@ -7,4 +7,4 @@ "keywords": [], "author": "", "license": "ISC" -} +} \ No newline at end of file diff --git a/packages/backend/CHANGELOG.md b/packages/backend/CHANGELOG.md index ed9fbb993e..c3954fe3f7 100644 --- a/packages/backend/CHANGELOG.md +++ b/packages/backend/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. ## [2.0.1-alpha.1](https://github.com/TryQuiet/backend/compare/@quiet/backend@2.0.1-alpha.0...@quiet/backend@2.0.1-alpha.1) (2023-09-25) +## [1.9.4](https://github.com/TryQuiet/backend/compare/@quiet/backend@1.9.3...@quiet/backend@1.9.4) (2023-10-03) **Note:** Version bump only for package @quiet/backend @@ -12,6 +13,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ## [2.0.1-alpha.0](https://github.com/TryQuiet/backend/compare/@quiet/backend@2.0.0-alpha.5...@quiet/backend@2.0.1-alpha.0) (2023-09-25) +## [1.9.3](https://github.com/TryQuiet/backend/compare/@quiet/backend@1.9.2...@quiet/backend@1.9.3) (2023-10-03) **Note:** Version bump only for package @quiet/backend @@ -20,6 +22,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline # [2.0.0-alpha.5](https://github.com/TryQuiet/backend/compare/@quiet/backend@2.0.0-alpha.4...@quiet/backend@2.0.0-alpha.5) (2023-09-19) +## [1.9.2](https://github.com/TryQuiet/backend/compare/@quiet/backend@1.9.1...@quiet/backend@1.9.2) (2023-09-25) **Note:** Version bump only for package @quiet/backend diff --git a/packages/backend/package.json b/packages/backend/package.json index 6c014c8999..399ef17617 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -149,4 +149,4 @@ "ipfs-pubsub-peer-monitor": "vinkabuki/ipfs-pubsub-peer-monitor#038af76f22e6c902dab4a855b24273707ce17d94" } } -} +} \ No newline at end of file diff --git a/packages/backend/src/nest/connections-manager/connections-manager.service.ts b/packages/backend/src/nest/connections-manager/connections-manager.service.ts index 9fff1face6..11aaec34df 100644 --- a/packages/backend/src/nest/connections-manager/connections-manager.service.ts +++ b/packages/backend/src/nest/connections-manager/connections-manager.service.ts @@ -353,7 +353,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI targetPort: this.ports.libp2pHiddenService, peers, } - this.logger('libp2p params', params) await this.libp2pService.createInstance(params) // KACPER diff --git a/packages/backend/src/nest/ipfs-file-manager/ipfs-file-manager.service.ts b/packages/backend/src/nest/ipfs-file-manager/ipfs-file-manager.service.ts index 31c5a9a538..b8cb12a034 100644 --- a/packages/backend/src/nest/ipfs-file-manager/ipfs-file-manager.service.ts +++ b/packages/backend/src/nest/ipfs-file-manager/ipfs-file-manager.service.ts @@ -2,6 +2,7 @@ import { Inject, Injectable } from '@nestjs/common' import { EventEmitter, setMaxListeners } from 'events' import fs from 'fs' import path from 'path' +import crypto from 'crypto' import PQueue, { AbortError } from 'p-queue' import { decode, PBNode } from '@ipld/dag-pb' import * as base58 from 'multiformats/bases/base58' @@ -433,13 +434,20 @@ export class IpfsFileManagerService extends EventEmitter { private async assemblyFile(fileMetadata: FileMetadata) { const _CID = CID.parse(fileMetadata.cid) - const downloadDirectory = path.join(this.quietDir, 'downloads', fileMetadata.cid) + const downloadDirectory = path.join(this.quietDir, 'downloads') createPaths([downloadDirectory]) - const fileName = fileMetadata.name + fileMetadata.ext - const filePath = `${path.join(downloadDirectory, fileName)}` - - const writeStream = fs.createWriteStream(filePath) + // As a quick fix, using a UUID for filename ensures that we never + // save a file with a malicious filename. Perhaps it's also + // possible to use the CID, however let's verify that first. + let fileName: string + let filePath: string + do { + fileName = crypto.randomUUID() + filePath = `${path.join(downloadDirectory, fileName)}` + } while (fs.existsSync(filePath)) + + const writeStream = fs.createWriteStream(filePath, { flags: 'wx' }) const entries = this.ipfs.cat(_CID) diff --git a/packages/backend/src/nest/socket/socket.service.spec.ts b/packages/backend/src/nest/socket/socket.service.spec.ts index 8afab44c23..f32ba21103 100644 --- a/packages/backend/src/nest/socket/socket.service.spec.ts +++ b/packages/backend/src/nest/socket/socket.service.spec.ts @@ -24,7 +24,7 @@ describe('SocketService', () => { module.init() - client = io(`http://localhost:${TEST_DATA_PORT}`) + client = io(`http://127.0.0.1:${TEST_DATA_PORT}`) }) afterAll(async () => { diff --git a/packages/backend/src/nest/socket/socket.service.ts b/packages/backend/src/nest/socket/socket.service.ts index 332263f3f2..5449c1d35b 100644 --- a/packages/backend/src/nest/socket/socket.service.ts +++ b/packages/backend/src/nest/socket/socket.service.ts @@ -172,9 +172,6 @@ export class SocketService extends EventEmitter implements OnModuleInit { ownerCertificate: payload.certificate, rootCa: payload.permsData.certificate, } - - console.log('Metadata from state-manager', communityMetadataPayload) - this.emit(SocketActionTypes.SEND_COMMUNITY_METADATA, communityMetadataPayload) }) @@ -214,7 +211,7 @@ export class SocketService extends EventEmitter implements OnModuleInit { public listen = async (port = this.configOptions.socketIOPort): Promise => { return await new Promise(resolve => { if (this.serverIoProvider.server.listening) resolve() - this.serverIoProvider.server.listen(this.configOptions.socketIOPort, () => { + this.serverIoProvider.server.listen(this.configOptions.socketIOPort, '127.0.0.1', () => { this.logger(`Data server running on port ${this.configOptions.socketIOPort}`) resolve() }) diff --git a/packages/desktop/CHANGELOG.md b/packages/desktop/CHANGELOG.md index ad1c5fa131..5b497b509e 100644 --- a/packages/desktop/CHANGELOG.md +++ b/packages/desktop/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. ## [2.0.1-alpha.1](https://github.com/ZbayApp/monorepo/compare/quiet@2.0.1-alpha.0...quiet@2.0.1-alpha.1) (2023-09-25) +## [1.9.4](https://github.com/TryQuiet/quiet/compare/quiet@1.9.3...quiet@1.9.4) (2023-10-03) **Note:** Version bump only for package quiet @@ -12,6 +13,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ## [2.0.1-alpha.0](https://github.com/ZbayApp/monorepo/compare/quiet@2.0.0-alpha.12...quiet@2.0.1-alpha.0) (2023-09-25) +## [1.9.3](https://github.com/TryQuiet/quiet/compare/quiet@1.9.2...quiet@1.9.3) (2023-10-03) **Note:** Version bump only for package quiet @@ -20,6 +22,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline # [2.0.0-alpha.12](https://github.com/TryQuiet/quiet/compare/quiet@2.0.0-alpha.11...quiet@2.0.0-alpha.12) (2023-09-20) +## [1.9.2](https://github.com/TryQuiet/quiet/compare/quiet@1.9.1...quiet@1.9.2) (2023-09-25) **Note:** Version bump only for package quiet diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 7d8ab9876e..8c2a0a4e3c 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -302,4 +302,4 @@ "node": "18.12.1", "npm": "8.19.2" } -} +} \ No newline at end of file diff --git a/packages/desktop/src/renderer/Root.tsx b/packages/desktop/src/renderer/Root.tsx index e5df08a227..608060d374 100644 --- a/packages/desktop/src/renderer/Root.tsx +++ b/packages/desktop/src/renderer/Root.tsx @@ -32,7 +32,7 @@ import { SaveStateComponent } from './components/SaveState/SaveStateComponent' import UnregisteredModalContainer from './components/widgets/userLabel/unregistered/UnregisteredModal.container' import DuplicateModalContainer from './components/widgets/userLabel/duplicate/DuplicateModal.container' import UsernameTakenModalContainer from './components/widgets/usernameTakenModal/UsernameTakenModal.container' -// Trigger lerna +import PossibleImpersonationAttackModalContainer from './components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container' export const persistor = persistStore(store) export default () => { @@ -49,6 +49,7 @@ export default () => { + diff --git a/packages/desktop/src/renderer/components/widgets/channels/BasicMessage.test.tsx b/packages/desktop/src/renderer/components/widgets/channels/BasicMessage.test.tsx index 5ea510e3df..d55f830c5e 100644 --- a/packages/desktop/src/renderer/components/widgets/channels/BasicMessage.test.tsx +++ b/packages/desktop/src/renderer/components/widgets/channels/BasicMessage.test.tsx @@ -36,6 +36,7 @@ describe('BasicMessage', () => { >
{ >
{ >
{ >
@@ -219,7 +220,7 @@ export const BasicMessageComponent: React.FC {userLabel && !infoMessage && ( - + { >
({ + [`& .${classes.bodyText}`]: { + textAlign: 'center', + width: '65%', + margin: '24px 0 4px', + }, + [`& .${classes.image}`]: { + width: '70px', + height: '70px', + margin: '30px 0 24px', + }, + [`& .${classes.button}`]: { + marginTop: 16, + textTransform: 'none', + padding: '0 24px', + height: 40, + borderRadius: '8px', + color: theme.palette.colors.white, + backgroundColor: theme.palette.colors.quietBlue, + '&:hover': { + opacity: 0.7, + backgroundColor: theme.palette.colors.quietBlue, + }, + }, +})) + +export interface PossibleImpersonationAttackModalComponentProps { + communityName: string + leaveCommunity: () => void + open: boolean + handleClose: () => void +} + +const PossibleImpersonationAttackModalComponent: React.FC = ({ + communityName, + leaveCommunity, + handleClose, + open, +}) => { + return ( + + + + Possible impersonation attack + + The owner of {communityName} has registered an invalid username. Either something is very + broken, the community owner is trying to impersonate other users, or the community owner has been hacked. +
+ This should never happen and we recommend leaving this community immediately! +
+ +
+
+ ) +} + +export default PossibleImpersonationAttackModalComponent diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container.tsx new file mode 100644 index 0000000000..bd7b75f913 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container.tsx @@ -0,0 +1,41 @@ +import { capitalizeFirstLetter } from '@quiet/common' +import { communities, users } from '@quiet/state-manager' +import React, { useEffect } from 'react' +import { useSelector } from 'react-redux' +import { clearCommunity } from '../../..' +import { useModal } from '../../../containers/hooks' +import { ModalName } from '../../../sagas/modals/modals.types' +import PossibleImpersonationAttackModalComponent from './PossibleImpersonationAttackModal.component' + +const PossibleImpersonationAttackModalContainer = () => { + const possibleImpersonationAttackModal = useModal(ModalName.possibleImpersonationAttackModal) + + const community = useSelector(communities.selectors.currentCommunity) + const duplicateCerts = useSelector(users.selectors.duplicateCerts) + + let communityName = '...' + + if (community?.name) { + communityName = capitalizeFirstLetter(community.name) + } + + const leaveCommunity = async () => { + await clearCommunity() + } + + useEffect(() => { + if (duplicateCerts) { + possibleImpersonationAttackModal.handleOpen() + } + }, [duplicateCerts]) + + return ( + + ) +} + +export default PossibleImpersonationAttackModalContainer diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.stories.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.stories.tsx new file mode 100644 index 0000000000..bd94e8c525 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.stories.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' +import { withTheme } from '../../../storybook/decorators' +import PossibleImpersonationAttackModalComponent, { + PossibleImpersonationAttackModalComponentProps, +} from './PossibleImpersonationAttackModal.component' + +const Template: ComponentStory = args => { + return ( +
+ +
+ ) +} + +export const Component = Template.bind({}) + +const args: PossibleImpersonationAttackModalComponentProps = { + handleClose: function (): void {}, + open: true, + communityName: 'devteam', + leaveCommunity: function (): void {}, +} + +Component.args = args + +const component: ComponentMeta = { + title: 'Components/PossibleImpersonationAttackModalComponent', + decorators: [withTheme], + component: PossibleImpersonationAttackModalComponent, +} + +export default component diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.test.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.test.tsx new file mode 100644 index 0000000000..5a5e512164 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.test.tsx @@ -0,0 +1,147 @@ +import React from 'react' +import theme from '../../../theme' +import { ThemeProvider } from '@mui/material/styles' +import { renderComponent } from '../../../testUtils/renderComponent' +import PossibleImpersonationAttackModalComponent from './PossibleImpersonationAttackModal.component' + +describe('PossibleImpersonationAttackModal', () => { + it('renderComponent', () => { + const result = renderComponent( + + {}} + open={true} + communityName={'devteam'} + leaveCommunity={() => {}} + /> + + ) + expect(result.baseElement).toMatchInlineSnapshot(` + +