Skip to content

Commit

Permalink
Added unit tests to critical crypto code (#139)
Browse files Browse the repository at this point in the history
* wip: jest - crypto unit tests

* rebase test-cases (#138)

* Build(deps): bump cryptography from 41.0.2 to 41.0.4 in /backend

Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.2 to 41.0.4.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@41.0.2...41.0.4)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps-dev): bump postcss from 8.4.23 to 8.4.31 in /frontend

Bumps [postcss](https://github.com/postcss/postcss) from 8.4.23 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](postcss/postcss@8.4.23...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps): bump graphql from 16.6.0 to 16.8.1 in /frontend

Bumps [graphql](https://github.com/graphql/graphql-js) from 16.6.0 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](graphql/graphql-js@v16.6.0...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps): bump semver and npm in /frontend

Bumps [semver](https://github.com/npm/node-semver) to 7.5.4 and updates ancestor dependencies [semver](https://github.com/npm/node-semver) and [npm](https://github.com/npm/cli). These dependencies need to be updated together.


Updates `semver` from 7.3.8 to 7.5.4
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](npm/node-semver@v7.3.8...v7.5.4)

Updates `semver` from 6.3.0 to 7.5.4
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](npm/node-semver@v7.3.8...v7.5.4)

Updates `npm` from 9.6.5 to 9.9.0
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/v9.9.0/CHANGELOG.md)
- [Commits](npm/cli@v9.6.5...v9.9.0)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
- dependency-name: semver
  dependency-type: indirect
- dependency-name: npm
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps): bump urllib3 from 1.26.14 to 1.26.18 in /backend

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.14 to 1.26.18.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@1.26.14...1.26.18)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update feature_request.md

* fix: secret history button label / title

* Fix  toastify css (#93)

* Update feature_request.md

* fix: react toastify css import

---------

Co-authored-by: Rohan Chaturvedi <[email protected]>

* fix: react toastify css import (#92)

* feat: added curl as a system dependency in frontend & backend Dockerfile (#95)

* feat: added curl as a system dependency in frontend & backend Dockerfile

* fix: install curl when one is root

* fix: move curl outside the scope of transient dependencies

* feat: webauth (#97)

* feat: webauth implementation

---------

Co-authored-by: rohan-chaturvedi <[email protected]>

* feat: posthog (#99)

* feat: added posthog analytics

* fix: log screen mask

* fix: protocols in dev env

* chore: disable nextjs telemetry (#104)

* chore: disable nextjs telemetry

* chore: eof new line

* refactor: onboarding (#105)

* refactor: onboarding

* fix: remove welcome screen, allow copying recovery kit

* fix: misc teaks to onboarding

* updated: copy on the invite onboarding

* updated: new device setup copy

* fix: typo in graphene type resolvers

* fix: allow copying recovery kit on invite screen to allow account creation

* feat: misc copy changes

---------

Co-authored-by: Nimish <[email protected]>

* Build(deps): bump django from 4.2.3 to 4.2.7 in /backend

Bumps [django](https://github.com/django/django) from 4.2.3 to 4.2.7.
- [Commits](django/django@4.2.3...4.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps): bump axios from 1.3.6 to 1.6.0 in /frontend

Bumps [axios](https://github.com/axios/axios) from 1.3.6 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.3.6...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps-dev): bump @babel/traverse from 7.21.4 to 7.23.3 in /frontend

Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.21.4 to 7.23.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.3/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Build(deps): bump twisted from 22.10.0 to 23.10.0 in /backend

Bumps [twisted](https://github.com/twisted/twisted) from 22.10.0 to 23.10.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](twisted/twisted@twisted-22.10.0...twisted-23.10.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: only fetch create and update events in secret history query (#106)

Co-authored-by: Nimish <[email protected]>

* fix: bump session cookie ttl to 1 week (#107)

Co-authored-by: Nimish <[email protected]>

* feat: display token environments in SecretTokens (#112)

* feat: display token environments in SecretTokens

* Updated 'name' with 'envType' in frontend/components/apps/tokens/SecretTokens.tsx

Co-authored-by: Rohan Chaturvedi <[email protected]>

* feat: improve envTypes UI in SecretTokens

* modified env type ui for light theme

---------

Co-authored-by: Rohan Chaturvedi <[email protected]>

* feat: add personal secret model

* feat: add graphql types and mutations

* feat: personal secrets ui, queries, mutations

* fix: misc ui fixes

* feat: add personal secrets to REST api response

* fix: operation name conflict, regenerate types

* fix: operation name

* fix: overlapping password icons | Edge Browser

* fix: misc improvements to app ui (#117)

* fix: misc ui updates to new app flow

* fix: rework app settings creen, fixes to app delete dialog

* feat: add is_active field to personal secret model

* feat: update frontend queries and mutations

* chore: regenerate types

* feat: show red spinner on danger buttons when isLoading

* feat: handle isActive field, misc ux improvements

* fix: remove console.log

* fix: Search UI for light theme

* fix: misc bugs, ui layout in override dialog

* fix: tweak spacing

* chore: bump posthog sdk version (#122)

* chore: bump posthog sdk version

* fix: lockfile

* feat: allow restoring secret values from history (#121)

* feat: allow restoring secret values from history

* feat: added label to the restore button

* fix: button ui

---------

Co-authored-by: Nimish <[email protected]>
Co-authored-by: Nimish <[email protected]>

* Fix: Search UI for Env Type (#125)

* Fixed Search UI for Env/Dev path

* removed white space

* fix: override resolver for secrets

* Chore: bump dependencies (#132)

* chore: bump posthog deps

* chore: bumped cryptography 41.0.6 to address openssl PKCS7

* feat: create new organisation button

* fix: moved button within dropdown

* fix: inserted optional type

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rohan Chaturvedi <[email protected]>
Co-authored-by: Amit Singh <[email protected]>
Co-authored-by: Amit Singh <[email protected]>

* chore: added jest

* feat: added hest config

* chore: add jest in tsconfig

* feat: export saltFromString

* feat: added cryptoutils tests

* feat: export VERSION and change cryptoUtils

* feat: add tests in ci

* fix: yarn directories in ci

* chore: added coverage to .gitingore

* reverted: imports

* feat: switched to jsdom; added module import context in jest config

* chore: added jest-environment-jsdom as a dev dependency

* chore: yarn lock

* fix: override test environment with node to fix TextDecoder error

* feat: added tests for environments crypto code

* feat: added test for phase recovery kit

* feat: added tests for secret sharding crypto

* chore: organized tests better, fixed imports

* chore: rename to environments

* chore: switch to module path for keyshares import

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rohan Chaturvedi <[email protected]>
Co-authored-by: Amit Singh <[email protected]>
Co-authored-by: Amit Singh <[email protected]>
  • Loading branch information
5 people authored Jan 11, 2024
1 parent 9a63cae commit 99b18c9
Show file tree
Hide file tree
Showing 13 changed files with 2,645 additions and 33 deletions.
46 changes: 45 additions & 1 deletion .github/workflows/docker_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ jobs:
id: short_sha
run: echo "::set-output name=sha::$(git rev-parse --verify HEAD | cut -c 1-7)"

- name: Set Node.js environment
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
run: |
cd frontend
yarn install
- name: Run Jest Tests
run: |
cd frontend
yarn test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand Down Expand Up @@ -79,6 +94,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set Node.js environment
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
run: |
cd frontend
yarn install
- name: Run Jest Tests
run: |
cd frontend
yarn test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand All @@ -95,7 +125,6 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Login to AWS Public ECR
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -131,6 +160,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set Node.js environment
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
run: |
cd frontend
yarn install
- name: Run Jest Tests
run: |
cd frontend
yarn test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ dmypy.json
.pnp.js

# testing
/coverage
/frontend/coverage

# next.js
*.next/
Expand Down
14 changes: 14 additions & 0 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['<rootDir>/tests'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1"
},

};
7 changes: 6 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dev": "NODE_ENV=development next dev",
"build": "next build",
"start": "next start",
"test": "jest",
"lint": "next lint",
"codegen": "graphql-codegen --config codegen.ts"
},
Expand Down Expand Up @@ -50,6 +51,7 @@
"@graphql-codegen/client-preset": "2.1.1",
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
"@types/country-flag-icons": "^1.2.0",
"@types/jest": "^29.5.11",
"@types/jsonwebtoken": "^9.0.1",
"@types/libsodium-wrappers-sumo": "^0.7.5",
"@types/react-icons": "^3.0.0",
Expand All @@ -62,8 +64,11 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8.4.31",
"prettier": "^2.8.4",
"tailwindcss": "^3.2.7"
"tailwindcss": "^3.2.7",
"ts-jest": "^29.1.1"
}
}
Loading

0 comments on commit 99b18c9

Please sign in to comment.