Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Updated recovery key parsing code to not rely on OS specific line endings #12717

Merged
merged 1 commit into from
Jan 19, 2018
Merged

Updated recovery key parsing code to not rely on OS specific line endings #12717

merged 1 commit into from
Jan 19, 2018

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Jan 19, 2018

Fixes #12716

Auditors: @kjozwiak, @NejcZdovc

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Automated Test Plan:

npm run unittest -- --grep="loadKeysFromBackupFile"

Test plan

See #12716

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@bsclifton bsclifton added this to the 0.19.x Hotfix 13 milestone Jan 19, 2018
@bsclifton bsclifton self-assigned this Jan 19, 2018
@@ -266,9 +266,9 @@ const loadKeysFromBackupFile = (state, filePath) => {
try {
const recoveryFileContents = data.toString()

let messageLines = recoveryFileContents.split(os.EOL)
let messageLines = recoveryFileContents.toString().match(/^.+$/gm)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need another toString? we are doing it on the line 267

…ings

Fixes #12716

Auditors: @kjozwiak, @NejcZdovc

Test Plan:
`npm run unittest -- --grep="loadKeysFromBackupFile"`
@codecov-io
Copy link

codecov-io commented Jan 19, 2018

Codecov Report

Merging #12717 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master   #12717      +/-   ##
==========================================
+ Coverage   56.09%   56.12%   +0.02%     
==========================================
  Files         279      279              
  Lines       27245    27245              
  Branches     4430     4430              
==========================================
+ Hits        15282    15290       +8     
+ Misses      11963    11955       -8
Flag Coverage Δ
#unittest 56.12% <100%> (+0.02%) ⬆️
Impacted Files Coverage Δ
app/browser/api/ledger.js 56.26% <100%> (+0.86%) ⬆️
js/stores/appStoreRenderer.js 91.17% <0%> (-8.83%) ⬇️
app/renderer/components/reduxComponent.js 84.37% <0%> (-6.25%) ⬇️
js/stores/windowStore.js 27.25% <0%> (-0.31%) ⬇️

Copy link
Contributor

@NejcZdovc NejcZdovc 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

Did the following test:

  1. clean profile
  2. save recovery file
  3. change EOL to windows style
  4. clean profile
  5. import windows style file

@NejcZdovc NejcZdovc merged commit fa416ba into brave:master Jan 19, 2018
NejcZdovc added a commit that referenced this pull request Jan 19, 2018
Updated recovery key parsing code to not rely on OS specific line endings
NejcZdovc added a commit that referenced this pull request Jan 19, 2018
Updated recovery key parsing code to not rely on OS specific line endings
NejcZdovc added a commit that referenced this pull request Jan 19, 2018
Updated recovery key parsing code to not rely on OS specific line endings
@NejcZdovc
Copy link
Contributor

master fa416ba
0.21 b13a380
0.20 b2c0673
0.19 8e59083

@bsclifton bsclifton deleted the restore-key-newline branch January 19, 2018 15:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants