From 46863ee53870a4d30c2142ea988fcd520e0c47c2 Mon Sep 17 00:00:00 2001 From: gayanmora Date: Sat, 20 Jun 2020 21:00:05 +0530 Subject: [PATCH 1/5] Related if/else if statements should not have the same condition --- MobileApp/src/components/UserDataHandling/UserDataHandling.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MobileApp/src/components/UserDataHandling/UserDataHandling.js b/MobileApp/src/components/UserDataHandling/UserDataHandling.js index 2f61b54c..2601a547 100644 --- a/MobileApp/src/components/UserDataHandling/UserDataHandling.js +++ b/MobileApp/src/components/UserDataHandling/UserDataHandling.js @@ -11,9 +11,9 @@ export function generateResult(data) { if (data.sex === 0) { result.push(['gender-male-female', 'Male']); - } else if (data.sex === 0) { + } else if (data.sex === 1) { result.push(['gender-male-female', 'Female']); - } else if (data.sex === 0) { + } else if (data.sex === 2) { result.push(['gender-male-female', 'Both male and female']); } else { result.push(['gender-male-female', "Don't know the gender"]); From 3fe2d3a3e10df52161e246eabd01832bcc251dde Mon Sep 17 00:00:00 2001 From: gayanmora Date: Sat, 20 Jun 2020 21:02:24 +0530 Subject: [PATCH 2/5] Property names should not be duplicated within a class or object literal --- MobileApp/src/screens/FormScreen/FormScreen.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/MobileApp/src/screens/FormScreen/FormScreen.js b/MobileApp/src/screens/FormScreen/FormScreen.js index b81cd646..58330c90 100644 --- a/MobileApp/src/screens/FormScreen/FormScreen.js +++ b/MobileApp/src/screens/FormScreen/FormScreen.js @@ -115,8 +115,6 @@ class FormScreen extends React.Component { isAlive: this.state.isAlive, location: this.state.location, time: this.state.time, - isAlive: this.state.isAlive, - address: this.state.address, verified: this.state.verified, notes: this.state.notes, park: this.state.park, From f4a2d0fff8dac3e01338a22d0d401797bca46470 Mon Sep 17 00:00:00 2001 From: gayanmora Date: Sat, 20 Jun 2020 21:04:20 +0530 Subject: [PATCH 3/5] Unused assignments should be removed --- MobileApp/src/screens/ProfileScreen/ProfileScreen.js | 1 - 1 file changed, 1 deletion(-) diff --git a/MobileApp/src/screens/ProfileScreen/ProfileScreen.js b/MobileApp/src/screens/ProfileScreen/ProfileScreen.js index eafbd21a..b4590525 100644 --- a/MobileApp/src/screens/ProfileScreen/ProfileScreen.js +++ b/MobileApp/src/screens/ProfileScreen/ProfileScreen.js @@ -87,7 +87,6 @@ class ProfileScreen extends React.Component { logutHandler = async () => { await this.closeMenu(); - let result = await auth() .signOut() .then(() => console.log('Log out')); }; From fabe2ff9bdff632bd04cf751880b9672eef906f5 Mon Sep 17 00:00:00 2001 From: gayanmora Date: Sat, 20 Jun 2020 21:48:14 +0530 Subject: [PATCH 4/5] Use of a Broken or Risky Cryptographic Algorithm --- MobileApp/src/components/UserDataHandling/UserDataHandling.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MobileApp/src/components/UserDataHandling/UserDataHandling.js b/MobileApp/src/components/UserDataHandling/UserDataHandling.js index 2601a547..fd868267 100644 --- a/MobileApp/src/components/UserDataHandling/UserDataHandling.js +++ b/MobileApp/src/components/UserDataHandling/UserDataHandling.js @@ -40,7 +40,7 @@ export function generateUUID() { let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function( c, ) { - let r = (dt + Math.random() * 16) % 16 | 0; + let r = (dt + window.Crypto.getRandomValues(new Uint32Array(1)) * 16) % 16 | 0; dt = Math.floor(dt / 16); return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16); }); From 4d600a2b3fc71dd23d12e7c63c25007b06656609 Mon Sep 17 00:00:00 2001 From: gayanmora Date: Sun, 21 Jun 2020 11:40:20 +0530 Subject: [PATCH 5/5] console log expose sensitive data --- MobileApp/src/components/FaceBookLogin/FaceBookLogin.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/MobileApp/src/components/FaceBookLogin/FaceBookLogin.js b/MobileApp/src/components/FaceBookLogin/FaceBookLogin.js index 1f29a290..b4753cda 100644 --- a/MobileApp/src/components/FaceBookLogin/FaceBookLogin.js +++ b/MobileApp/src/components/FaceBookLogin/FaceBookLogin.js @@ -11,8 +11,6 @@ export async function facebookLogin(navigate) { return } - console.log(`Login success with permissions: ${result.grantedPermissions.toString()}`); - // get the access token const data = await AccessToken.getCurrentAccessToken(); @@ -25,7 +23,6 @@ export async function facebookLogin(navigate) { // login with credential await firebase.auth().signInWithCredential(credential).then((user)=>{ - console.log(JSON.stringify(user.user.toJSON().uid)) const uid = user.user.toJSON().uid const name = user.user.toJSON().displayName const email = user.user.toJSON().email