Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

fix: reverts assumeRole to use pod role instead of web identity #453

Merged
merged 1 commit into from
Jul 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions config/aws-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
const AWS = require('aws-sdk')
const clonedeep = require('lodash.clonedeep')
const merge = require('lodash.merge')
const fs = require('fs')

const localstack = process.env.LOCALSTACK || 0
const webIdentity = process.env.AWS_WEB_IDENTITY_TOKEN_FILE || 0

let secretsManagerConfig = {}
let systemManagerConfig = {}
Expand All @@ -31,10 +29,6 @@ if (localstack) {
}
}

function loadServiceToken () {
return fs.readFileSync(webIdentity, 'utf8')
}

module.exports = {
secretsManagerFactory: (opts = {}) => {
if (localstack) {
Expand All @@ -50,16 +44,6 @@ module.exports = {
},
assumeRole: (assumeRoleOpts) => {
const sts = new AWS.STS(stsConfig)
if (webIdentity) {
return new Promise((resolve, reject) => {
sts.assumeRoleWithWebIdentity(merge(assumeRoleOpts, { WebIdentityToken: loadServiceToken() }), (err, res) => {
if (err) {
return reject(err)
}
resolve(res)
})
})
}

return new Promise((resolve, reject) => {
sts.assumeRole(assumeRoleOpts, (err, res) => {
Expand Down