Schedule icon
AwsCLI icon
If icon
SlackIncomingWebhook icon
Log icon

AWS Security Hub Active Critical/High Finding Sentinel

Audit AWS Security Hub for active critical or high severity findings and alert Slack with the exact title before it is missed.

Categories
CloudInfrastructure

Security Hub aggregates findings from GuardDuty, Inspector, IAM Access Analyzer, Config, and its own built-in security standards into one place, but it has no built-in way to say "notify this Slack channel the moment a CRITICAL or HIGH finding appears" without wiring an EventBridge rule and a notification target per account - a separate configuration surface from the flow that actually needs to react. This blueprint queries Security Hub's own finding list, filtered server-side, and alerts Slack directly with the exact title and severity.

How it works

  1. periodic_finding_check (io.kestra.plugin.core.trigger.Schedule) runs every 30 minutes, explicitly passing aws_region through its own inputs: block so the flow is self-contained when the trigger fires. Shipped disabled so a manual run can be verified first.
  2. probe_active_findings (io.kestra.plugin.aws.cli.AwsCLI) runs aws securityhub get-findings with a --filters JSON for SeverityLabel in (CRITICAL, HIGH) and RecordState == ACTIVE, capturing the result's Findings list (full finding objects, not just IDs) as a named task output.
  3. evaluate_findings_presence (io.kestra.plugin.core.flow.If) branches on whether that list has any entries at all.
    • then (ACTIVE_FINDINGS_DETECTED): alert_active_findings reports each finding's severity and title to Slack.
    • else (HEALTHY): log_no_active_findings records a clean sweep.
  4. log_audit_complete always runs last, printing the active finding count regardless of which branch fired.
  5. The errors block alerts Slack separately if the flow itself fails outright - Security Hub not being enabled in the region, or bad credentials, must not read as HEALTHY.

What you get

  • A HEALTHY/ACTIVE_FINDINGS_DETECTED answer computed by Security Hub's own server-side severity and record-state filter, not by paging through every finding (low-severity and archived included) and filtering client-side.
  • A single-call probe: unlike a per-source approach (one check per GuardDuty, Inspector, Config, and so on), this one call covers every finding source Security Hub has aggregated.
  • The exact finding title and severity in the Slack alert itself, instead of requiring someone to open the Security Hub console to see what was detected.
  • A worked example of io.kestra.plugin.aws.cli.AwsCLI driving a read-only, filtered Security Hub audit, reusing the same corrected output-capture convention (newlines only, not spaces, stripped before the marker) as this repository's CloudFormation, AWS Config, AWS Backup, and GuardDuty sentinel blueprints.

Who it's for

  • Cloud security teams running Security Hub who need a single, aggregated signal across every finding source, without wiring a separate EventBridge-to-notification pipeline per source.
  • On-call engineers who want one Slack alert with the exact finding title and severity instead of opening the Security Hub console to check manually.
  • Anyone evaluating the AWS plugin who wants a worked example of AwsCLI driving a filtered Security Hub audit with correctly combined AND/OR filter semantics.

Why orchestrate this with Kestra

Security Hub itself has no cross-account "notify me the moment a CRITICAL or HIGH finding appears" primitive beyond what you wire up separately in EventBridge and SNS, configuration that then has to be kept in sync as the account grows. Kestra supplies the schedule, the HEALTHY/ACTIVE_FINDINGS_DETECTED classification as a first-class branch, and an execution history that shows exactly when a finding was detected and what Security Hub's own aggregation said about it.

Prerequisites

  • An AWS account with Security Hub enabled in the target region (update aws_region).
  • AWS credentials with securityhub:GetFindings permission - entirely read-only, cannot modify, archive, or change the workflow status of any finding.
  • A Slack incoming webhook for alerts.

This blueprint has no confirmed local, account-free testing path. LocalStack's exact tier requirement for the Security Hub service was not conclusively confirmed during research, but LocalStack now requires its own account and auth token as of March 2026 regardless, since the Community and Pro images were consolidated into one entitlement-gated image. A real AWS account with Security Hub enabled is the practical way to exercise this blueprint.

Secrets

  • AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY: credentials for io.kestra.plugin.aws.cli.AwsCLI.
  • SLACK_WEBHOOK_URL: Slack incoming webhook used by alert_active_findings and the errors block.
  • In Kestra OSS (no Enterprise secrets backend), secrets are supplied as environment variables prefixed SECRET_, base64-encoded - for example SECRET_AWS_SECRET_ACCESS_KEY=$(echo -n '<your-secret-key>' | base64) - and read back in flows with {{ secret('NAME') }}.

Inputs

  • aws_region (STRING, default us-east-1): region whose Security Hub findings are audited.

Outputs

  • outputs.probe_active_findings.vars.Findings: the list of matching finding objects, each with Id, Title, Description, SeverityLabel, RecordState, WorkflowState (deprecated in favor of WorkflowStatus), ProductName, CreatedAt, UpdatedAt (verified fields from Security Hub's own GetFindings API reference).

Quick start

  1. Enable Security Hub in a real AWS account and let it run long enough to aggregate at least one finding from an enabled source (GuardDuty, Inspector, Config, and so on).
  2. Add the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK_URL secrets.
  3. Run the flow manually against a quiet account and confirm log_no_active_findings fires.
  4. Trigger a real finding (for example, GuardDuty's own create-sample-findings, which Security Hub will also ingest if that product is enabled) and re-run to confirm alert_active_findings fires with the real title and severity.
  5. Enable periodic_finding_check once you trust the check against your real account.

How to extend

  • Loop over several aws_region values with io.kestra.plugin.core.flow.Loop to audit every region where Security Hub is enabled in one run.
  • Add ProductName to the filter to scope the check to a specific finding source (for example, only GuardDuty-originated findings) instead of every aggregated source.
  • Add a remediation branch that updates a finding's workflow status to SUPPRESSED (aws securityhub batch-update-findings) once a human has reviewed and dismissed it as a false positive, behind an explicit approval gate - deliberately kept out of this sentinel so the monitoring path never changes any finding's state.

Pitfalls

  • Pagination is not handled. get-findings is itself paginated; if more matching findings exist than fit in one page, this blueprint's single call only sees the first page - see How to extend for scoping the filter further, or extend with --starting-token handling.
  • WorkflowState is a deprecated field per AWS's own API reference, which recommends WorkflowStatus instead - this blueprint does not filter on either, since RecordState (ACTIVE/ARCHIVED) already captures the distinction this sentinel cares about, but an extension that needs to distinguish NEW from already-triaged findings should use WorkflowStatus, not the deprecated field.
  • Security Hub's filter semantics are OR within the same attribute and AND across attributes (verified from AWS's own Security Hub user guide) - this is why SeverityLabel lists two entries (CRITICAL, HIGH, meaning either) while RecordState is a separate, ANDed attribute (ACTIVE only). Getting this backwards would silently change what the filter actually matches.
  • The output-capture convention (tr -d '\n' | xargs -0 -I {} echo '::{"outputs":{}}::') deliberately does not strip spaces, the same corrected pattern used in this repository's CloudFormation, AWS Config, AWS Backup, and GuardDuty sentinel blueprints, since Title and Description are human-readable sentences that stripping spaces would corrupt.
  • This blueprint is UNTESTED against a live AWS account. The get-findings CLI syntax, the Filters JSON structure, the documented AND/OR filter semantics, and the Findings / SeverityLabel / RecordState / Title output fields are taken verbatim from AWS's own Security Hub API reference and user guide documentation - but no Kestra engine was run to execute this flow end to end.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.