Skip to content

Commit

Permalink
Merge pull request #204 from cozy/fix/prevent_crash_shared_orgs_no_key
Browse files Browse the repository at this point in the history
feat: Prevent crash web vault contains organizations with no key
  • Loading branch information
Ldoppea authored Oct 19, 2022
2 parents d9aca5b + 6a0a1d6 commit 5aacc80
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/WebVaultClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { CipherService } from './@bitwarden/jslib/services/cipher.service'

import { CollectionService } from './@bitwarden/jslib/services/collection.service'
import { ContainerService } from './@bitwarden/jslib/services/container.service'
import { CryptoService } from './@bitwarden/jslib/services/crypto.service'
import { EnvironmentService } from './@bitwarden/jslib/services/environment.service'
import { FolderService } from './@bitwarden/jslib/services/folder.service'
import { I18nService } from './@bitwarden/jslib/services/i18n.service'
Expand Down Expand Up @@ -45,6 +44,7 @@ import { KdfRequest } from './@bitwarden/jslib/models/request/kdfRequest'
import WebPlatformUtilsService from './WebPlatformUtilsService'
import HtmlStorageService from './HtmlStorageService'
import MemoryStorageService from './MemoryStorageService'
import { CryptoService } from './services/crypto.service'

import * as CozyUtils from './CozyUtils'
import logger from './logger'
Expand Down
23 changes: 23 additions & 0 deletions src/services/crypto.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { CryptoService as CryptoServiceBase } from '../@bitwarden/jslib/services/crypto.service'

export class CryptoService extends CryptoServiceBase {
constructor(
storageService,
secureStorageService,
cryptoFunctionService,
platformUtilService
) {
super(
storageService,
secureStorageService,
cryptoFunctionService,
platformUtilService
)
}

setOrgKeys(orgs) {
const validOrgs = orgs.filter(org => org.key !== '')

return super.setOrgKeys(validOrgs)
}
}

0 comments on commit 5aacc80

Please sign in to comment.