Skip to content
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

Fix updated vault decryption #63

Merged
merged 5 commits into from
Dec 15, 2023
Merged

Fix updated vault decryption #63

merged 5 commits into from
Dec 15, 2023

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Dec 14, 2023

#62 introduced an additional attempt to encrypt the vault, but:

  1. The bundle.js was not properly updated
  2. The used regex does not cover all cases

This PR fixes the problem by recovering the vault part by part, to ensure capturing only the needed parts

@mikesposito mikesposito marked this pull request as ready for review December 14, 2023 15:07
@mikesposito mikesposito requested a review from legobeat December 14, 2023 15:08
@mikesposito mikesposito marked this pull request as draft December 14, 2023 15:43
@mikesposito mikesposito marked this pull request as ready for review December 14, 2023 20:04
@mcmire
Copy link
Contributor

mcmire commented Dec 14, 2023

@mikesposito Your changes makes sense, but is there a way I can test this PR manually considering there aren't any tests for this repo?

@legobeat
Copy link
Contributor

legobeat commented Dec 15, 2023

@mikesposito Your changes makes sense, but is there a way I can test this PR manually considering there aren't any tests for this repo?

The repo does have tests as of #47. I think ideally another fixture should be added here (or replace the existing added in #62) to also cover the missing cases mentioned.

As for testing manually: Fire up the built frontend in a browser and upload / paste data into the form alongside your passphrase as extracted from filesystem directory following the linked user guide.

@mikesposito
Copy link
Member Author

I think ideally another fixture should be added here (or replace the existing added in #62) to also cover the missing cases mentioned.

Good point! I added a new test fixture with the .log file that was causing trouble

@@ -64,11 +64,25 @@ function extractVaultFromFile (data) {
// attempt 4: chromium 000006.log on MacOS
// this variant also contains a 'keyMetadata' key in the vault, which should be
// a nested object.
const matches = data.match(/KeyringController":(\{"vault":".*=\\"\}"\})/);
const matches = data.match(/KeyringController":(\{"vault":".*?=\\"\}"\})/);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lazy (?) operator here is important, because there are instances of .log files that present multiple occurrences of this, and in these cases if we don't use the lazy operator we'll match the entire text between the start of the first occurrence and the end of the last one. We are instead only interested in the first occurrence.

@mcmire
Copy link
Contributor

mcmire commented Dec 15, 2023

@legobeat Ah sorry. You're right — thanks for adding those tests.

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mikesposito mikesposito merged commit fc05554 into master Dec 15, 2023
6 checks passed
@mikesposito mikesposito deleted the fix/var-assignment branch December 15, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants