Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion lib/common-templates/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ governing permissions and limitations under the License.
*
*/
function stringParameters (params) {
// hide credentials from the include-ims-credentials annotation
let imsCredentials = params.__ims_oauth_s2s || {}
if (imsCredentials.client_secret) {
imsCredentials = { ...imsCredentials, client_secret: '<hidden>' }
}
// hide authorization token without overriding params
let headers = params.__ow_headers || {}
if (headers.authorization) {
headers = { ...headers, authorization: '<hidden>' }
}
return JSON.stringify({ ...params, __ow_headers: headers })

return JSON.stringify({ ...params, __ow_headers: headers, __ims_oauth_s2s: imsCredentials })
Comment thread
moritzraho marked this conversation as resolved.
Outdated
}

/**
Expand Down
7 changes: 7 additions & 0 deletions lib/common-templates/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ describe('stringParameters', () => {
expect(utils.stringParameters(params)).toEqual(expect.stringContaining('"authorization":"<hidden>"'))
expect(utils.stringParameters(params)).not.toEqual(expect.stringContaining('secret'))
})
test('with ims credentials', () => {
const params = {
a: 1, b: 2, __ims_oauth_s2s: { client_id: 'fake-client-id', client_secret: 'secret', org_id: 'fake@AdobeOrg' }
}
expect(utils.stringParameters(params)).toEqual(expect.stringContaining('"client_secret":"<hidden>"'))
expect(utils.stringParameters(params)).not.toEqual(expect.stringContaining('secret'))
Comment thread
moritzraho marked this conversation as resolved.
Outdated
})
})

describe('checkMissingRequestInputs', () => {
Expand Down