Remove private fields when listing domains

Currently, domains list route does not return the fallback cert.
make it future proof, just in case.
This commit is contained in:
Girish Ramakrishnan
2018-04-27 11:38:09 -07:00
parent 7a8c525beb
commit b72efb1018
2 changed files with 12 additions and 4 deletions
+3 -3
View File
@@ -47,9 +47,7 @@ function get(req, res, next) {
if (error && error.reason === DomainError.NOT_FOUND) return next(new HttpError(404, error.message));
if (error) return next(new HttpError(500, error));
delete result.fallbackCertificate.key; // do not return the 'key'. in caas, this is private
next(new HttpSuccess(200, result));
next(new HttpSuccess(200, domains.removePrivateFields(result)));
});
}
@@ -57,6 +55,8 @@ function getAll(req, res, next) {
domains.getAll(function (error, result) {
if (error) return next(new HttpError(500, error));
result = result.map(domains.removePrivateFields);
next(new HttpSuccess(200, { domains: result }));
});
}