Skip to content

Commit

Permalink
[SWIK-1163_security_issues] Moved all secrets to aother file which is…
Browse files Browse the repository at this point in the history
… just included in services
  • Loading branch information
TBoonX committed Jun 15, 2017
1 parent e91a1bf commit 20e0b75
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 1 addition & 3 deletions configs/microservices.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ export default {
uri: 'https://notificationservice.experimental.slidewiki.org'
},
'user': {
uri: 'https://userservice.experimental.slidewiki.org',
resetPasswordAPIKey: '2cbc621f86e97189239ee8c4c80b10b3a935b8a9f5db3def7b6a3ae7c4b75cb5',
PRIVATE_RECAPTCHA_KEY: '6LdNLyYTAAAAAFMC0J_zuVI1b9lXWZjPH6WLe-vJ'
uri: 'https://userservice.experimental.slidewiki.org'
},
'import': {
uri: 'https://importservice.experimental.slidewiki.org',
Expand Down
4 changes: 4 additions & 0 deletions configs/secrets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
resetPasswordAPIKey: '2cbc621f86e97189239ee8c4c80b10b3a935b8a9f5db3def7b6a3ae7c4b75cb5',
PRIVATE_RECAPTCHA_KEY: '6LdNLyYTAAAAAFMC0J_zuVI1b9lXWZjPH6WLe-vJ'
};
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ env | grep "SLIDEWIKI_.*"

cat /nodeApp/microservices.js.template | envsubst > /nodeApp/configs/microservices.js
cat /nodeApp/general.js.template | envsubst > /nodeApp/configs/general.js
cat /nodeApp/secrets.js.template | envsubst > /nodeApp/configs/secrets.js
npm run build
4 changes: 1 addition & 3 deletions microservices.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export default {
uri: '${SERVICE_URL_NOTIFICATION}'
},
'user': {
uri: '${SERVICE_URL_USER}',
resetPasswordAPIKey: '${SERVICE_USER_APIKEY}',
PRIVATE_RECAPTCHA_KEY: '${SERVICE_USER_PRIVATE_RECAPTCHA_KEY}'
uri: '${SERVICE_URL_USER}'
},
'import': {
uri: '${SERVICE_URL_IMPORT}',
Expand Down
4 changes: 4 additions & 0 deletions secrets.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
resetPasswordAPIKey: '${SERVICE_USER_APIKEY}',
PRIVATE_RECAPTCHA_KEY: '${SERVICE_USER_PRIVATE_RECAPTCHA_KEY}'
};
5 changes: 3 additions & 2 deletions services/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Microservices } from '../configs/microservices';
import { hashingSalt } from '../configs/general';
import rp from 'request-promise';
import secrets from '../configs/secrets';
const log = require('../configs/log').log;

export default {
Expand Down Expand Up @@ -108,7 +109,7 @@ export default {
rp.post({ //TODO increase timeout
uri: 'https://www.google.com/recaptcha/api/siteverify',
form: {
secret: Microservices.user.PRIVATE_RECAPTCHA_KEY,
secret: secrets.PRIVATE_RECAPTCHA_KEY,
response: args.grecaptcharesponse
}
})
Expand Down Expand Up @@ -211,7 +212,7 @@ export default {
body: JSON.stringify({
email: params.email,
language: params.language,
APIKey: Microservices.user.resetPasswordAPIKey,
APIKey: secrets.resetPasswordAPIKey,
salt: hashingSalt
}),
resolveWithFullResponse: true
Expand Down

0 comments on commit 20e0b75

Please sign in to comment.