mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-22 11:53:01 +00:00
Merge pull request #11816 from overleaf/jpa-re-encrypt-v2
[access-token-encryptor] flag v2 tokens for re-encryption GitOrigin-RevId: 4ccb6d220d74a821f2fef8c72267f174cc2c502f
This commit is contained in:
parent
b531105446
commit
d06a578492
2 changed files with 7 additions and 7 deletions
|
@ -68,14 +68,14 @@ async function reEncryptTokensInCollection({
|
|||
for (const [name, path] of Object.entries(paths)) {
|
||||
const blob = _.get(doc, path)
|
||||
if (!blob) continue
|
||||
// Schema: LABEL:SALT:CIPHERTEXT:IV
|
||||
const [label, , , iv] = blob.split(':', 4)
|
||||
const version = iv ? 'v2' : 'v1'
|
||||
// Schema: LABEL-VERSION:SALT:CIPHERTEXT:IV
|
||||
const [label] = blob.split(':')
|
||||
const [, version] = label.split('-')
|
||||
|
||||
const key = [name, version, collectionName, path, label].join(':')
|
||||
stats[key] = (stats[key] || 0) + 1
|
||||
|
||||
if (version === 'v1') {
|
||||
if (version === 'v2') {
|
||||
update = update || {}
|
||||
update[path] = await reEncryptTokens(accessTokenEncryptor, blob)
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@ async function count(collectionName, paths) {
|
|||
for (const [name, path] of Object.entries(paths)) {
|
||||
const blob = _.get(doc, path)
|
||||
if (!blob) continue
|
||||
// Schema: LABEL:SALT:CIPHERTEXT:IV
|
||||
const [label, , , iv] = blob.split(':', 4)
|
||||
const version = iv ? 'v2' : 'v1'
|
||||
// Schema: LABEL-VERSION:SALT:CIPHERTEXT:IV
|
||||
const [label] = blob.split(':')
|
||||
const [, version] = label.split('-')
|
||||
|
||||
const key = [name, version, collectionName, path, label].join(':')
|
||||
stats[key] = (stats[key] || 0) + 1
|
||||
|
|
Loading…
Reference in a new issue