UNPKG

cloud-report

Version:

Collects and analyzes cloud resources

45 lines (44 loc) 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const types_1 = require("../../../types"); const base_1 = require("../../base"); class CloudTrailsGlobalEventsAnalyzer extends base_1.BaseAnalyzer { analyze(params, fullReport) { const allTrails = params.cloud_trails; if (!allTrails) { return undefined; } const cloud_trails_global_service_events = { type: types_1.CheckAnalysisType.Security }; cloud_trails_global_service_events.what = "Are global service events included in CloudTrails?"; cloud_trails_global_service_events.why = `We need to enable this option to keep track of events from global service like IAM`; cloud_trails_global_service_events.recommendation = `Recommended to enable IncludeGlobalServiceEvents for CloudTrails`; cloud_trails_global_service_events.benchmark = ['all']; const allRegionsAnalysis = {}; for (const region in allTrails) { const regionTrails = allTrails[region]; allRegionsAnalysis[region] = []; for (const trail of regionTrails) { const trail_analysis = {}; trail_analysis.resource = trail; trail_analysis.resourceSummary = { name: "CloudTrail", value: trail.Name, }; if (trail.IncludeGlobalServiceEvents) { trail_analysis.severity = types_1.SeverityStatus.Good; trail_analysis.message = "Global service events are included"; } else { trail_analysis.severity = types_1.SeverityStatus.Failure; trail_analysis.message = "Global service events are not included"; trail_analysis.action = "Enable IncludeGlobalServiceEvents"; } allRegionsAnalysis[region].push(trail_analysis); } } cloud_trails_global_service_events.regions = allRegionsAnalysis; return { cloud_trails_global_service_events }; } } exports.CloudTrailsGlobalEventsAnalyzer = CloudTrailsGlobalEventsAnalyzer;