ADR-0050: An audit trail for the account, and alerts on outside access and the root user#
- Status: proposed
- Date: 2026-12-01
Context#
The account keeps only CloudTrail's Event history: 90 days of management events, read in the console, with nothing alerting on anything in it. The drift runbook and the deploy path compromise runbook rely on it to find who changed what. Defacement through the deploy path is the first threat in scope (threat model), and the root user is kept for emergencies only, yet nothing would say if it signed in, or if a policy began to let something outside the account in.
Principle 7 counts each mechanism as a cost, and ADR-0029 asks what a new one retires.
Decision#
A module of the stack, audit, applied by terraform-apply, adds three things:
- One trail of management events, read and write, from every region, to a
testz-*-auditbucket: versioned, public access blocked, written only by CloudTrail for this trail (aws:SourceArn), refusing requests without TLS, with log file validation on and objects expiring after a year. No data events and no CloudWatch Logs delivery. - IAM Access Analyzer, an external access analyzer for the account. The CI roles' trust in GitHub's OIDC provider is expected and archived by a rule naming that provider and those roles, so any other finding is a new way in.
- Three EventBridge rules to the existing SNS topic, so to the alarm address, whose policy lets EventBridge publish: a console sign-in by the root user; a new active analyzer finding; and
StopLogging,DeleteTrailorUpdateTrailon the trail.
The plan role reads CloudTrail, Access Analyzer and EventBridge, and the apply role writes them, through the bootstrap layer first, as adding an AWS service says. The apply role is denied reading the audit bucket's objects, as it is the stored mail's.
Each piece is shown to work before it is relied on: signing in as the root user once must send the email, and validating the trail's digest files with aws cloudtrail validate-logs must pass.
None of the existing mechanisms can go: none sees the account's own API activity. This is three mechanisms that each watch something nothing else does.
Alternatives considered#
Do nothing. Event history answers "who" for 90 days, which covers the weekly drift run. It alerts on nothing, and an incident found later than that has no record.
GuardDuty. Infers misuse from the same events, but is billed per event and reports inferences, not records. On the radar under Assess, to weigh once this is in place.
CloudWatch Logs delivery with metric filters and alarms, the usual benchmark pattern. Billed per gigabyte ingested, and each alarm takes one of the ten free alarm metrics, of which the stack uses six, and the rehearsal zone the rest.
AWS Config or Security Hub. Configuration recording and its checks are billed per item and per evaluation, and drift detection already compares the configuration with main.
The trail in the bootstrap layer, out of the apply role's reach. The bootstrap role may change only IAM, so it needs a seed run with a temporary user (ADR-0016). The apply role can stop the trail, but cannot hide that it did: the call is in Event history, which nobody can turn off, and the last rule emails it.
Object Lock on the bucket. Compliance mode cannot be undone, so a teardown would wait out the retention. Log file validation already shows an edited or deleted log, which is what the trail is for.
Consequences#
Positive: who did what is kept for a year and can be shown not to have been edited. A new door into the account, a root sign-in, and the trail being stopped each send an email within minutes.
Negative: three services more to keep right, and three more for the plan role to read. The bucket holds the account's own activity, including the addresses the owner signs in from: personal data about the owner, none about visitors. The apply role, the one an attacker would most want, can stop the trail; that is seen, not prevented. The alerts reach the mailbox only, not an issue.
Neutral: the first copy of management events is free, and a year of a small account's events in S3 costs cents a month. Access Analyzer's external access analysis and EventBridge rules on AWS service events cost nothing. Event history is unchanged.
Revisit when#
- A second person gets access to the account, or it joins an organization whose trail would cover it.
- The audit bucket grows past a few hundred megabytes, or the bill by more than ten cents a month.
- GuardDuty moves from Assess, which would make the alerts here partly redundant.