# Template rules

Every Guard rule HKB runs on its CloudFormation templates. CI runs them on each change as a warning, and the pipeline's Validate stage runs them again, so a template that breaks a rule is stopped before the pipeline deploys it. Each rule's ID is a control on the [controls page](/controls/), and an exception to one is recorded with its reason and expiry.

5 rules, one page each.

| Rule | What it requires | Source |
| --- | --- | --- |
| [GR-02](/wiki/guard/gr-02/) | every IAM role carries a permissions boundary (hkb-pipeline-boundary or hkb-workload-boundary; D81, DQ-75, DQ-76). | `guard/rules/gr-02-role-boundary.guard` |
| [GR-03](/wiki/guard/gr-03/) | TAG-01 tag keys on taggable resources (Component on environment-scoped ones, DQ-128), and hkb- names for named resources. | `guard/rules/gr-03-tags-and-names.guard` |
| [GR-04](/wiki/guard/gr-04/) | no long-lived credentials. No IAM users or access keys. | `guard/rules/gr-04-no-iam-users.guard` |
| [GR-05](/wiki/guard/gr-05/) | S3 baseline. Block Public Access on, SSE-KMS, and a bucket policy that denies non-TLS requests. | `guard/rules/gr-05-s3-baseline.guard` |
| [GR-06](/wiki/guard/gr-06/) | stateful resources keep their data. Retain on delete and replace; symmetric KMS keys rotate. | `guard/rules/gr-06-stateful-retain.guard` |
