diff --git a/website/scripts/send-data-to-vanta.js b/website/scripts/send-data-to-vanta.js index 46798b8d6f22..0128a6c59cf8 100644 --- a/website/scripts/send-data-to-vanta.js +++ b/website/scripts/send-data-to-vanta.js @@ -1,3 +1,5 @@ +const userAgent = 'Fleet/Vanta Updater'; + module.exports = { @@ -63,7 +65,7 @@ module.exports = { responseFromUserEndpoint = await sails.helpers.http.get( updatedRecord.fleetInstanceUrl + '/api/v1/fleet/users', {}, - {'Authorization': 'Bearer '+updatedRecord.fleetApiKey } + {'Authorization': 'Bearer '+updatedRecord.fleetApiKey, 'User-Agent': userAgent } ) .retry() .tolerate((err)=>{// If an error occurs while sending a request to the Fleet instance, we'll add the error to the errorReportById object, with this connections ID set as the key. @@ -136,7 +138,7 @@ module.exports = { let getHostsResponse = await sails.helpers.http.get( `${updatedRecord.fleetInstanceUrl}/api/v1/fleet/hosts?per_page=${numberOfHostsPerRequest}&page=${pageNumberForPossiblePaginatedResults}`, {}, - {'Authorization': 'bearer '+updatedRecord.fleetApiKey}, + {'Authorization': 'bearer '+updatedRecord.fleetApiKey, 'User-Agent': userAgent}, ) .retry(); // Add the results to the allHostsOnThisFleetInstance array. @@ -154,6 +156,14 @@ module.exports = { return; } + // If this is Fleet's Vanta connection, exclude hosts on the "Compliance exclusions" team. + // See https://github.com/fleetdm/fleet/issues/19312 for more information. + if(vantaConnection.id === 3){ + allHostsOnThisFleetInstance = allHostsOnThisFleetInstance.filter((host)=>{ + return host.team_id !== 178;// Compliance exclusions team + }); + } + let macOsHosts = allHostsOnThisFleetInstance.filter((host)=>{ return host.platform === 'darwin'; }); @@ -203,7 +213,7 @@ module.exports = { let detailedInformationAboutThisHost = await sails.helpers.http.get( updatedRecord.fleetInstanceUrl + '/api/v1/fleet/hosts/'+encodeURIComponent(hostIdAsString), {}, - {'Authorization': 'bearer '+updatedRecord.fleetApiKey} + {'Authorization': 'bearer '+updatedRecord.fleetApiKey, 'User-Agent': userAgent} ) .retry() .intercept((err)=>{// If an error occurs while sending a request to the Fleet instance, we'll throw an error. @@ -291,7 +301,7 @@ module.exports = { let detailedInformationAboutThisHost = await sails.helpers.http.get( updatedRecord.fleetInstanceUrl + '/api/v1/fleet/hosts/'+encodeURIComponent(hostIdAsString), {}, - {'Authorization': 'bearer '+updatedRecord.fleetApiKey} + {'Authorization': 'bearer '+updatedRecord.fleetApiKey, 'User-Agent': userAgent} ) .retry() .intercept((err)=>{// If an error occurs while sending a request to the Fleet instance, we'll throw an error.