-
Notifications
You must be signed in to change notification settings - Fork 96
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
Update notification #478
Merged
Merged
Update notification #478
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import semver from 'semver'; | ||
const pkg = require('../../package.json'); | ||
import settingsClient from "../utils/settingsClient"; | ||
import hip2Client from '../utils/hip2Client'; | ||
import { SET_HIP2_PORT } from "./hip2Reducer"; | ||
|
@@ -6,12 +8,30 @@ const SET_DEEPLINK = 'app/setDeeplink'; | |
const SET_LOCALE = 'app/setLocale'; | ||
const SET_CUSTOM_LOCALE = 'app/setCustomLocale'; | ||
const SET_DEEPLINK_PARAMS = 'app/setDeeplinkParams'; | ||
const SET_UPDATE_AVAILABLE = 'app/setUpdateAvailable'; | ||
|
||
const initialState = { | ||
deeplink: '', | ||
deeplinkParams: {}, | ||
locale: '', | ||
customLocale: null, | ||
updateAvailable: null, | ||
}; | ||
|
||
export const checkForUpdates = () => async (dispatch) => { | ||
const latestRelease = await settingsClient.getLatestRelease(); | ||
if (!latestRelease) return; | ||
|
||
const canUpdate = semver.gt(latestRelease.tag_name.replace(/$v/i, ''), pkg.version); | ||
if (canUpdate) { | ||
dispatch({ | ||
type: SET_UPDATE_AVAILABLE, | ||
payload: { | ||
version: latestRelease.tag_name, | ||
url: `https://github.com/kyokan/bob-wallet/releases/tag/${latestRelease.tag_name}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, good change. |
||
}, | ||
}); | ||
} | ||
}; | ||
|
||
export const initHip2 = () => async (dispatch) => { | ||
|
@@ -103,6 +123,11 @@ export default function appReducer(state = initialState, action) { | |
...state, | ||
customLocale: action.payload, | ||
}; | ||
case SET_UPDATE_AVAILABLE: | ||
return { | ||
...state, | ||
updateAvailable: action.payload, | ||
}; | ||
default: | ||
return state; | ||
} | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Mine as well check some kind of signature, even if its a brand new bob-release-update published by kyokan. Especially because you use
url: latestRelease.html_url,
down below. Giving users a link to click is a target for attacks, treat it like a nuclear bomb.https://bitcoinist.com/electrum-wallet-phishing-bitcoin/
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.
Wow didn't think of that. Unlikely, but def possible.
How about always linking to
https://github.com/kyokan/bob-wallet/releases/tag/{TAG}
instead oflatestRelease.html_url
?Not sure what signature can be checked here. Do you mean like with PGP? It's just a link so no info to verify.
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.
Look around how other popular wallets like Electrum and Wasabi handle this. Hard coding the link feels good. As far as signature what I meant was that Kyokan should publish a new key (hey maybe an HNS address so we can use rpc verify message) and Bob will verify an update notification from whatever source. I dunno if it's possible to check that the release signature on github is correct before notifying the user. Whatever works out, just keep in mind attackers would love to get Bob users to download malware with one button click, so line up the troops.
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.
Updated to prefix url and only use tag. imo the only way to break this would be to MITM a HTTPS req to github.com, which if someone can do, there are bigger problems already.
Requires the node to be synced :|
Afaik, no. We could download another file and check that, but again relies on an external source, mostly over https, with the same attack vectors as https://github.com. Additionally, verifying a file would mean downloading the actual binary from within Bob which feels more dangerous.
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.
no, just the address, not the NAME.