The alert fired at 03:17. Infrastructure drift. OAuth scopes had changed without a commit or a review.
Infrastructure as Code (IaC) gives you consistency, but it is fragile when reality drifts from the plan. Drift detection finds those differences: changed configurations, altered permissions, unexpected scope expansions. Without it, your IaC can silently diverge from production, and OAuth scopes—critical to secure API access—can creep beyond their intended boundaries.
OAuth scopes define what an application can do with a token. Scope changes can widen access in ways that break compliance or open security holes. Managing scopes in code ensures they are versioned, reviewed, and deployed as part of the pipeline. But scope changes outside of IaC bypass that control.
IaC drift detection for OAuth scopes management starts with a baseline. Store all scope definitions in code. Use tools that compare the live state to the code state. Integrate these checks into CI/CD so any mismatch blocks deployment or triggers investigation. When drift is detected—like a broad read_write scope replacing a narrow read—you must trace it back to its origin, log the event, and roll back to the approved configuration.