# hkb-forward-guardduty

Fires on: GuardDuty detector and member changes.

Run the [common pre-checks](/wiki/runbooks/#common-pre-checks) first.

## Symptoms
An email from `hkb security alert`: `SECURITY EVENT aws.guardduty <call> in account <member>`. A detector was deleted or changed, or a member was disassociated or stopped. This is a change to GuardDuty itself, not a finding.

## Pre-checks
1. Read `errorCode`. SCP-03 denies deleting a detector and leaving the administrator account in every member account, so those calls are denied.
2. `UpdateDetector` and the member calls (`DeleteMembers`, `DisassociateMembers`, `StopMonitoringMembers`) aren't denied: they are the Security account's administrator calls. One made by the pipeline while `hkb-security-services` changes is expected.

## Resolution
- **Denied:** identify the caller.
- **Succeeded, unplanned:** the account may be unwatched. From the Security account, check its membership (`aws guardduty list-members --profile ro-hkb-security`), re-enable the detector or re-add the member, and confirm auto-enable is still `ALL`.

## Post-checks
The member shows `Enabled` in the Security account's member list, and the control tests' GuardDuty checks pass.

## Rollback
Not needed: re-adding a member restores the original state.

## Alert details

| Property | Value |
| --- | --- |
| Runs in | every member account, both Regions, forwarded to the `hkb-security-events` bus in Security |
| Email | From `hkb security alert`: `SECURITY EVENT <src> <what> in account <account>, <region>, at <time> by <who>.` |
| Source | `baseline/hkb-baseline-events.yaml`, resource `GuardDutyRule` |

The event pattern, as deployed:

```yaml
EventPattern:
  source: [aws.guardduty]
  detail-type: [AWS API Call via CloudTrail]
  detail:
    eventSource: [guardduty.amazonaws.com]
    eventName: [DeleteDetector, UpdateDetector, DisassociateFromAdministratorAccount, DisassociateFromMasterAccount, DeleteMembers, DisassociateMembers, StopMonitoringMembers]
```
