100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
CI/CD, GitOps, DevSecOps & Observability
25 minintermediate

Shift-left security — SAST with Semgrep and CodeQL in Actions

Shift-left security is the practice of moving security testing earlier in the software development lifecycle—specifically into the developer's workflow and the CI pipeline—rather than leaving it to a dedicated security team review after code is written. The cost of fixing a vulnerability discovered by an engineer as they write the code is measured in minutes. The same fix discovered by a penetration test after deployment is measured in days of cross-team coordination, incident management, and potential data exposure.

Static Application Security Testing analyses source code without executing it, looking for patterns that indicate security vulnerabilities: SQL injection, hardcoded secrets, insecure cryptography, command injection, and hundreds of other categories. Two tools dominate SAST in GitHub Actions pipelines: Semgrep, which uses pattern-matching rules with a low false positive rate and supports custom rule authoring, and CodeQL, which builds a semantic model of the code and queries it for vulnerability patterns, finding deeper issues that pattern matching misses.

Analogy🏏Cricket
Think of it like cricket: Imagine the BCCI's team management system for an international tour with matches in three different countries simultaneously. Rather than a coordinator manually managing each match day's logistics, the system reads the official tour schedule document and automatically dispatches the right squad, equipment, and support staff to each venue. When the tour schedule changes—a match is rescheduled, a squad member is replaced—the system detects the change and updates the arrangements automatically. Just as the tour management system uses the official document as the source of truth and orchestrates multiple concurrent deployments to multiple venues, ArgoCD uses the Git repository as the source of truth and orchestrates multiple concurrent Application syncs to multiple clusters. Just as the system provides a dashboard showing which venues are 'ready', 'delayed', or 'degraded', ArgoCD provides a dashboard showing which Applications are Synced, OutOfSync, or Degraded. This reveals why ArgoCD is valued at scale: managing dozens of applications across multiple clusters manually is operationally equivalent to coordinating an international cricket tour by phone.
Lesson 8 of 33
0% complete