-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
UPDATE blobs SET blobId = REPLACE(blobId, '+', 'X'); | ||
UPDATE blobs SET blobId = REPLACE(blobId, '/', 'Y'); | ||
|
||
UPDATE notes SET blobId = REPLACE(blobId, '+', 'X'); | ||
UPDATE notes SET blobId = REPLACE(blobId, '/', 'Y'); | ||
|
||
UPDATE attachments SET blobId = REPLACE(blobId, '+', 'X'); | ||
UPDATE attachments SET blobId = REPLACE(blobId, '/', 'Y'); | ||
|
||
UPDATE revisions SET blobId = REPLACE(blobId, '+', 'X'); | ||
UPDATE revisions SET blobId = REPLACE(blobId, '/', 'Y'); | ||
|
||
UPDATE entity_changes SET entityId = REPLACE(entityId, '+', 'X') WHERE entityName = 'blobs'; | ||
UPDATE entity_changes SET entityId = REPLACE(entityId, '/', 'Y') WHERE entityName = 'blobs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f704cac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the
base64url
encoding (https://en.wikipedia.org/wiki/Base64 with-
and_
instead of+
and/
; or another one) be used here, instead of performing manual replacement?For example, if the
sha512
digest contains the following sequence (in hex)abcfffe5589
, it'sq8//5VgJ
inbase64
, and it would becomeq8YY5VgJ
after replacement.But it's the same
base64
value as the sequence (in hex)abc618e5589
:q8YY5VgJ
f704cac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically I'm trying to avoid any non-alphanumeric characters and this is a stupid way to do it.
This hash is not security sensitive, so I believe it's OK.
f704cac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use https://github.com/cryptocoinjs/base-x (or b62/base32, but base-x seems to be faster according to https://stackoverflow.com/questions/30468292/how-to-generate-base62-uuids-in-node-js / https://gist.github.com/dmarcelino/879d4da2a0e0c32f7d74)?
But while it weaken the hash / increase probability of collisions, I won't insist, it's just it looked weird to me (and I found this because I'm still on an old version and I've seen reports of corruptions in newer versions).