Skip to content

[PM-6271] Propose cipher versioning with migration in data layer #9337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

coroiu
Copy link
Contributor

@coroiu coroiu commented May 23, 2024

Type of change

- [ ] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

This PR contains a proof of concept for the "Data layer" approach described here: https://bitwarden.atlassian.net/wiki/spaces/~62955327d9eae9006f348ae9/pages/944701442/Proof+of+concept+Cipher+versioning#Data-%E2%80%9Clayer%E2%80%9D

image

Code changes

The PR contains a lot of changes, but most are either import path changes or duplicate boilerplate code.
The important parts are:

API Layer

  • libs/common/src/vault/models/ciphers/api/v1 & v2: These folders contain the representation of the different
    versions of ciphers in the api layer. These are used by both responses and requests
  • libs/common/src/vault/models/ciphers/response/v1 & v2: These folders contain the representation of the different versions of ciphers in the api layer
  • libs/common/src/vault/models/ciphers/response/version-agnostic: This contains a wrapper on top of v1/v2 to allow the rest of the codebase to handle responses without necessarily knowing which version it has.

Data Layer

  • libs/common/src/vault/models/ciphers/data/v1 & v2: These folders contain the representation of the different
    versions of ciphers in the data layer.
  • libs/common/src/vault/models/ciphers/response/version-agnostic: This contains a wrapper on top of v1/v2 to allow the rest of the codebase to handle data classes without necessarily knowing which version it has. This class is also responsible for migration between versions.

Cipher Service

  • libs/common/src/vault/services/cipher.service.ts Updated to support migration

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
  • Ensure that all UI additions follow WCAG AA requirements

coroiu added 6 commits May 23, 2024 13:12
This commit will not compile because the connection between data -> domain is not yet implemented here.
The cipher service is still not properly implemented in this commit.

This commit does not actually implement the migration algorithm.
No more build errors. Just need to implement migration in CipherData
@github-actions github-actions bot added the needs-qa Marks a PR as requiring QA approval label May 23, 2024
Copy link
Contributor

github-actions bot commented May 23, 2024

Logo
Checkmarx One – Scan Summary & Details5a37619c-74ce-417f-ab7e-fcdd7c00abb9

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 481 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 473 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 457 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 465 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 496
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 488
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 480
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 504

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-qa Marks a PR as requiring QA approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant