diff --git a/website/scripts/send-data-to-vanta.js b/website/scripts/send-data-to-vanta.js index 2e7e2a3407..d8dd0c4526 100644 --- a/website/scripts/send-data-to-vanta.js +++ b/website/scripts/send-data-to-vanta.js @@ -8,6 +8,7 @@ module.exports = { fn: async function () { + let util = require('util'); // Find all VantaConnection records with isConnectedToVanta: true let allActiveVantaConnections = await VantaConnection.find({isConnectedToVanta: true}); @@ -198,6 +199,10 @@ module.exports = { return new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), an error occurred: ${err}`); }); + if(!detailedInformationAboutThisHost.host) { + throw new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), the response from the Fleet API did not include a host. Response from the Fleet API: ${util.inspect(detailedInformationAboutThisHost)}`); + } + if (detailedInformationAboutThisHost.host.disk_encryption_enabled !== undefined && detailedInformationAboutThisHost.host.disk_encryption_enabled !== null) { // Build a drive object for this host, using the host's disk_encryption_enabled value to set the boolean values for `encrytped` and `filevaultEnabled` let driveInformationForThisHost = { @@ -283,6 +288,10 @@ module.exports = { return new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), an error occurred: ${err}`); }); + if(!detailedInformationAboutThisHost.host){ + throw new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), the response from the Fleet API did not include a host. Response from the Fleet API: ${util.inspect(detailedInformationAboutThisHost)}`); + } + if (detailedInformationAboutThisHost.host.disk_encryption_enabled !== undefined && detailedInformationAboutThisHost.host.disk_encryption_enabled !== null) { // Build a drive object for this host, using the host's disk_encryption_enabled value to set the boolean values for `encrytped` and `filevaultEnabled` let driveInformationForThisHost = {