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

Audit logs, stricter signing, and fetch rpc gasPrice #124

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

hashmesan
Copy link

Changes in this PR (1.2.7)

Audit Logs

Audit logs are event logging stored in chrome.storage (higher storage limits than localStorage). It stores all the internalEvents, externalEvents, as well as any decrypt fails, successful send one, send token, stake, sign transaction.

Logs can be downloaded from settings menu as JSON.

image

Strict Signing

  • Any signing in the .vue files were moved into the services level, isolating from view possible access
  • Remove "privateKey" states variables in vue, thus removing from memory
  • Remove of static "harmony" instances which privateKeys were injected and kept in memory

Misc

  • Dynamic RPC gasPrice fetching
  • Previous un-merged PR for docker build process

hashmesan added 10 commits January 24, 2022 17:08
* Using metamask ob-store to sync chrome storage and logs
* pass password instead of private key down to service level
* event logging for decrypt key error,  sign, send, sign, and staking
* removal of harmony static instance (storing private key)
* removal of privatekey in vue states
@hashmesan
Copy link
Author

BUILD: onewallet.zip

Checksums

f154b1cb14edddb503f0eb206fc02619  dist/background.js
a977b17761041948fbf5fb078e3516d5  dist/content-script.js
56b83367de1bad67f158c51ac140006a  dist/inject-script.js
65279d2f01367823f85977f02fd36293  dist/popup.js
604c6d74953a59aedc1af4c4f0b94e16  dist/popup.html

chrome.runtime.sendMessage(
{ action: GET_LOGS },
async (state) => {
var blob = new Blob([JSON.stringify(state, null, '\t')], {type: "application/json;charset=utf-8"});

Choose a reason for hiding this comment

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

JSON stringify can be quite slow if state has a large number of rows (array elements). But I think in most cases it should be fine

@polymorpher
Copy link

The change looks good. Reviewing all code from scratch and testing

@@ -275,12 +275,11 @@ export default {
this.$notify({
group: "notify",
type: "error",
text: err.message,
text: this.caption,

Choose a reason for hiding this comment

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

Sanitize this to prevent injection? See Matthew's report

Copy link
Author

Choose a reason for hiding this comment

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

Added lodash escape in new commit

@polymorpher
Copy link

Code looks good (checked independent of the diffs)

@@ -10,7 +10,7 @@
},
"scripts": {
"dev": "NODE_ENV=development webpack --progress --watch",
"build": "NODE_ENV=production webpack --progress && md5sum dist/*.js dist/*.html > dist/checksums.md5"
"build": "NODE_ENV=production webpack --progress && cd dist && find -type f -exec md5sum {} \\;|sort -s > checksums.md5"

Choose a reason for hiding this comment

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

find... filter for .html and .js?

Copy link
Author

Choose a reason for hiding this comment

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

Changed so the output path in md5 doesn't have the "dist" so you can compare checksum easier. Everything is relative to the current directory. Also opened up to any files checksums just in case...

@polymorpher
Copy link

Hash confirmed. Transfer and Delegate operations are tested. Signing (smart contract call), personal sign (offline), undelegate, and collectreward are not tested yet

9dd83b1e280ac286a73d1dd77d1a630e  onewallet.zip



f154b1cb14edddb503f0eb206fc02619  onewallet/background.js
a977b17761041948fbf5fb078e3516d5  onewallet/content-script.js
56b83367de1bad67f158c51ac140006a  onewallet/inject-script.js
b848e51f945486bc2ed9c6d132be76fa  onewallet/popup.js
604c6d74953a59aedc1af4c4f0b94e16  onewallet/popup.html

@hashmesan
Copy link
Author

@polymorpher

New checksum is

f154b1cb14edddb503f0eb206fc02619  dist/background.js
a977b17761041948fbf5fb078e3516d5  dist/content-script.js
56b83367de1bad67f158c51ac140006a  dist/inject-script.js
65279d2f01367823f85977f02fd36293  dist/popup.js
604c6d74953a59aedc1af4c4f0b94e16  dist/popup.html

@polymorpher
Copy link

polymorpher commented Mar 10, 2022

New changes look good. Also I got hashes

f154b1cb14edddb503f0eb206fc02619  onewallet/background.js
a977b17761041948fbf5fb078e3516d5  onewallet/content-script.js
56b83367de1bad67f158c51ac140006a  onewallet/inject-script.js
ce8793e5caccd76ef073947346e533ca  onewallet/popup.js
604c6d74953a59aedc1af4c4f0b94e16  onewallet/popup.html

@hashmesan
Copy link
Author

It was cached. I added echo to break it..

FROM node:14

WORKDIR /usr/src/app
RUN echo 1 # increment this
RUN git clone https://github.com/harmony-one/chrome-extension-wallet.git
WORKDIR /usr/src/app/chrome-extension-wallet
RUN git fetch origin pull/124/head
RUN npm install
RUN npm run build

It matches now:

f154b1cb14edddb503f0eb206fc02619  dist/background.js
a977b17761041948fbf5fb078e3516d5  dist/content-script.js
56b83367de1bad67f158c51ac140006a  dist/inject-script.js
ce8793e5caccd76ef073947346e533ca  dist/popup.js
604c6d74953a59aedc1af4c4f0b94e16  dist/popup.html

@hashmesan
Copy link
Author

@polymorpher Previous build didn't checkout PR.

This is the correct Dockerfile

FROM node:14

WORKDIR /usr/src/app
RUN git clone https://github.com/harmony-one/chrome-extension-wallet.git
WORKDIR /usr/src/app/chrome-extension-wallet
RUN git fetch origin pull/124/head && git checkout FETCH_HEAD
RUN git log -3
RUN npm install
RUN npm run build

and build without cache

docker build -t chrome-build --no-cache .

@polymorpher
Copy link

okay, hashes are

27271cad9dc90f25a7f2eab2861eab2b  onewallet/background.js
156770284f99f8e9019a15f7419c34f5  onewallet/content-script.js
c163f7329920e2e512dcfc3e63410711  onewallet/inject-script.js
6fe27b144e95dfd5110067afde96ed54  onewallet/popup.js
604c6d74953a59aedc1af4c4f0b94e16  onewallet/popup.html

@polymorpher
Copy link

I think this is ready for a release

@hashmesan
Copy link
Author

Signatures match -- all go for release.

012cf6a10129e2275d79d6adac7f3b02  ./fonts/MaterialIcons-Regular.woff
1484aa61aca6d60d7818332e5b8664c6  ./images/harmony-big.png
156770284f99f8e9019a15f7419c34f5  ./content-script.js   YES
27271cad9dc90f25a7f2eab2861eab2b  ./background.js YES
2b470564821c19dc383cf82898a868e4  ./images/ethereum.svg
4528eed8118cc703671f71957fd87c4d  ./images/[email protected]
4d0322f2fda4a30ee3a898757c47977f  ./icons/48.ico
570eb83859dc23dd0eec423a49e147fe  ./fonts/MaterialIcons-Regular.woff2
604c6d74953a59aedc1af4c4f0b94e16  ./popup.html
68913d3bc039d80bd467980faa9d51d3  ./icons/32.ico
6fe27b144e95dfd5110067afde96ed54  ./popup.js YEES
874b4b4ebaec45c6c0e05387e9f6d691  ./icons/128.ico
8e32989352f3d547ebc63d3510b55f0a  ./images/ledger.svg
8ed9856b3f59fcf36200322dc557deef  ./images/NFT_Icon.png
9016d84af20bc6da450d59f12aea1312  ./images/[email protected]
a022c272f8a0684cb05231175d5e7801  ./images/logo-blue.png
a37b0c01c0baf1888ca812cc0508f6e2  ./fonts/MaterialIcons-Regular.ttf
aee863680e754c3dca89e3b36a51aec1  ./images/harmony.png
c163f7329920e2e512dcfc3e63410711  ./inject-script.js YES
d41d8cd98f00b204e9800998ecf8427e  ./checksums.md5
d46d16a8c8e007d131c9723b385f9fff  ./images/harmony-small.png
e79bfd88537def476913f3ed52f4f4b3  ./fonts/MaterialIcons-Regular.eot
f49efa127672ce747c4420b7e82722ad  ./manifest.json
facc320e952f28067026f857a6a87862  ./icons/16.ico

@polymorpher
Copy link

merge this? since it is already deployed

@hashmesan
Copy link
Author

Updated build. All the scripts checksums are the same. The only file changed is the manifest.json.
onewallet.zip

@polymorpher
Copy link

27271cad9dc90f25a7f2eab2861eab2b  onewallet/background.js
156770284f99f8e9019a15f7419c34f5  onewallet/content-script.js
c163f7329920e2e512dcfc3e63410711  onewallet/inject-script.js
d4a7f353b15d476b897c16a138cf877e  onewallet/popup.js
604c6d74953a59aedc1af4c4f0b94e16  onewallet/popup.html

@polymorpher
Copy link

I also changed version to 1.2.8

@hashmesan
Copy link
Author

New build for modaljs fix

onewallet.zip

83c6ac4975b001cb2912c50515f600e9  ./inject-script.js
9750b2210ecf5a2742b08f91f89da993  ./background.js
b97a025a8fe2532f9f9fa638c5756992  ./popup.js
c0684567a05868201c4bd8290b75da5f  ./manifest.json
f867f05b8c8ea89abe5b0eea2f87ac5b  ./content-script.js

@polymorpher
Copy link

I built with termsModal set to width: "100%", height: "600px”

9750b2210ecf5a2742b08f91f89da993  onewallet/background.js
f867f05b8c8ea89abe5b0eea2f87ac5b  onewallet/content-script.js
83c6ac4975b001cb2912c50515f600e9  onewallet/inject-script.js
b97a025a8fe2532f9f9fa638c5756992  onewallet/popup.js
604c6d74953a59aedc1af4c4f0b94e16  onewallet/popup.html
c0684567a05868201c4bd8290b75da5f  onewallet/manifest.json

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.

2 participants