From 274c2761cf84232ab2e87f686dc5b8f7ff008096 Mon Sep 17 00:00:00 2001 From: Phil Booth Date: Fri, 22 Jun 2018 13:21:56 +0100 Subject: [PATCH] fix(fn): don't leak error details back to the caller --- index.js | 2 +- test.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 4ae7ce9..ba2a18e 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,7 @@ async function main (data) { } catch(error) { return { statusCode: 500, - body: error.stack, + body: 'Internal Server Error', isBase64Encoded: false } } diff --git a/test.js b/test.js index 591b033..4227453 100644 --- a/test.js +++ b/test.js @@ -482,10 +482,11 @@ suite('fxa-sendgrid-event-proxy:', () => { }) test('result is correct', () => { - return promise.then(result => { - assert.equal(result.statusCode, 500) - assert.equal(result.body.indexOf('Error'), 0) - }) + return promise.then(result => assert.deepEqual(result, { + statusCode: 500, + body: 'Internal Server Error', + isBase64Encoded: false + })) }) }) })