A Leader in the 2025 Gartner® Magic Quadrant™ for Endpoint Protection Platforms. Five years running.A Leader in the Gartner® Magic Quadrant™Read the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI Security Portfolio
      Leading the Way in AI-Powered Security Solutions
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly ingest data from on-prem, cloud or hybrid environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Identity Security
    • Singularity Identity
      Identity Threat Detection and Response
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-class Expertise and Threat Intelligence.
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      Digital Forensics, IRR & Breach Readiness
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive solutions for seamless security operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • Partner Locator
      Your go-to source for our top partners in your region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
Background image for What is GitLab IaC Scanning?
Cybersecurity 101/Cloud Security/GitLab IaC Scanning

What is GitLab IaC Scanning?

Fully integrate and automate your credentials testing and secure GitLab repos with IaC scanning. Incorporate GitOps deployments and resolve critical security concerns effortlessly using GitLab IaC scanning.

CS-101_Cloud.svg
Table of Contents

Related Articles

  • Infrastructure as a Service: Benefit, Challenges & Use Cases
  • What is Cloud Forensics?
  • Cloud Security Strategy: Key Pillars for Protecting Data and Workloads in the Cloud
  • Cloud Threat Detection & Defense: Advanced Methods 2025
Author: SentinelOne
Updated: July 30, 2025

Infrastructure as Code (IaC) has rapidly emerged as a game-changer of the modern tech landscape. By translating infrastructure provisioning and management processes into code, developers gain version control and repeatability, and potential vulnerabilities are reduced, yet with its proliferation comes potential vulnerability issues.

GitLab IaC Scanning stands out as an effective and efficient means of discovering misconfigurations and security gaps within IaC setups while protecting against them. This guide will dive deep into its value, setup process, and best practices to fortify IaC configurations.

GitLab IaC Scanning - Featured Image | SentinelOne

What is Infrastructure as Code (IaC)?

Infrastructure as Code (IaC) is an approach where infrastructure provisioning, management, and configuration tasks are specified as code rather than through manual processes or custom scripts. Instead of depending on manual processes for provisioning servers, databases, or networking infrastructure components, IaC utilizes standard code templates.

IaC’s popularity can be explained by an ever-increasing need for agility when deploying and scaling applications. Traditional infrastructure management required time-intensive setup that often relied on human error; IaC offers consistency, repeatability, and speedy update processes by versioning infrastructure just like software code, allowing versioned repeatable infrastructure builds to run continuously without human oversight or error.

DevOps practices also synergize well with IaC practices, helping organizations bridge the divide between development and operations. With IaC, infrastructure changes can be implemented concurrently with application development for faster deployment times and smoother pipeline management. Their combined efforts propel organizations toward increased efficiency and reliability during deployment processes.

Why is IaC Scanning Essential?

Infrastructure as Code has opened up new avenues of potential vulnerability. Developers writing scripts to automate infrastructure deployment may inadvertently introduce significant security gaps into an infrastructure deployment process; IaC scanning becomes essential in detecting such security holes before they reach production environments.

Modern cloud-native infrastructures can be quite dynamic and complex environments; misconfigurations may slip past even the most vigilant of developers, even without IaC scanning tools sifting through code definitions to detect misconfigurations that violate best security practices and reduce data breaches and system compromise due to infrastructure vulnerabilities. IaC scan tools use Artificial Intelligence-as-a-Consumption technology (AIC). By doing so, they dramatically lower risks related to infrastructure vulnerabilities causing data breaches or system compromise.

As compliance and data protection standards have tightened, businesses need to implement secure infrastructure from day one to avoid legal or reputational ramifications. IaC scanning helps businesses adhere to this norm by guaranteeing their infrastructure aligns with industry regulations, thereby protecting themselves against legal repercussions.

Understanding GitLab IaC Scanning

GitLab’s Infrastructure as Code (IaC) Scanning feature offers a systematic approach to vet IaC configuration files against potential vulnerabilities. This ensures that the configurations to provision and manage infrastructure are robust, secure, and compliant. The support extends to various IaC configuration files, including popular ones like Terraform, Ansible, AWS CloudFormation, and Kubernetes.

  1. Requirements and Compatibility
  2. Supported Files and Customization
  3. Configuration and Rule Customization
  4. Automatic Vulnerability Resolution

1. Requirements and Compatibility

Effective IaC scanning requires working within the test stage, as it requires inclusion in this stage’s.gitlab-ci.yml file.

  • Minimum RAM requirements should be 4GB to maximize performance. 
  • By default, GitLab Runner with either Docker or Kubernetes executor is mandatory (and enabled automatically for GitLab.com users). However, IaC Scanning analyzers may be incompatible with non-amd64 CPU architectures & it’s best advised that Docker version 19.03.0 be avoided for these jobs.

2. Supported Files and Customization

GitLab IaC Scanning provides comprehensive support, made possible through the KICS tool. Configuration files from Ansible, AWS CloudFormation, Azure Resource Manager Dockerfile, Google Deployment Manager Kubernetes OpenAPI Terraform are among those supported; any specific requirements such as JSON formatted Azure Resource Manager templates being required and no support for custom registry Terraform modules should also be taken into consideration when reviewing results.

GitLab continues its dedication to openness with this feature by making all open-source (OSS) analyzers available through GitLab Free tier. By manipulating the SAST_IMAGE_SUFFIX variable, you can toggle between standard and FIPS versions of images.

3. Configuration and Rule Customization

Establishing IaC Scanning in your project is relatively straightforward. You can either set it manually by including the SAST-IaC.gitlab-ci.yml template, which, once included, generates IaC Scanning jobs within your CI/CD pipeline, or automatically through merge requests – results of IaC Scanning jobs being stored as SAST report artifacts after scanning is complete.

Teams looking to enhance the scanning process have the option of customizing default rules; this feature includes being able to:

  • Disable predefined rules. 
  • Override existing ones with custom definitions that affect aspects like severity or linking directly to personal documentation.

It’s also possible to associate scanning processes with specific analyzer versions, protecting in case updates bring regressions or unwanted modifications.

4. Automatic Vulnerability Resolution

GitLab IaC Scanning emphasizes eliminating unnecessary noise in reports. To maintain relevance and focus on current vulnerabilities, the system takes certain automatic actions:

1. Disabling Rules: Once you decide that one or more rules are no longer relevant to your project and have explicitly disabled them, their previous reports of vulnerabilities will automatically resolve.

2. Rule Removal: Should GitLab decide that one or more default rules are obsolete or produce too many false positives, they will likely be eliminated, and any vulnerabilities flagged by such rules will automatically be resolved.

3. Historical Records: Maintaining an audit trail is vital; GitLab’s Vulnerability Management system adds comments, ensuring you remain aware of past vulnerabilities that have been automated and resolved.

4. Rule Re-activation: Reenabling previously disabled rules will open any auto-resolved findings for triage again to ensure past vulnerabilities don’t go undetected.

Reporting: Understanding the JSON Format

GitLab’s IaC Scanning tool outputs its findings as structured JSON reports to conform with SAST report formats, providing users with comprehensive results:

1. Standardization: This format facilitates easy integration and comparison across various projects or scans.

2. Accessibility: Users can quickly and easily download reports directly from CI pipelines pages or merge request pipelines using artifacts: paths directive to “gl-sast-report.json”. To facilitate this action, set your artifacts: paths directive as “gl-sast-report.json”.

3. Schema Reference: GitLab offers detailed schema documentation to enable those interested in delving deeper or integrating this report with other systems to access all parts of it easily and comprehensively.

Setting Up GitLab IaC Scanning

Let’s examine how to set up GitLab IaC Scanning for your projects.

Steps for setting Up GitLab IaC Scanning are –

  1. Prerequisites
  2. Integrating the GitLab CI/CD
  3. Custom Configuration (Optional)
  4. Running the Scan
  5. Reviewing Results

1. Prerequisites

  • GitLab Version: You should ensure you’re using version 12.10 or later of GitLab. 
  • Repository Setup: Your Infrastructure as Code files (such as Terraform, CloudFormation, and Kubernetes config files) should form part of your repository.

2. Integrating the GitLab CI/CD

To set up IaC scanning, you’ll need to integrate it with the GitLab CI/CD pipeline.

Create or update .gitlab-ci.yml in the root of your repository.

Add the following configuration:

Include:

  template: Security/Infrastructure-Scanning.gitlab-ci.yml

This inclusion will enable the IaC Scanning job within your CI/CD pipeline.

3. Custom Configuration (Optional)

For projects with specific requirements, the scanning process can be customized:

  • Custom Rules: GitLab IaC Scanning allows users to define custom rules or modify existing ones. These can be added to a .iac-custom-rules directory at the root of your repository.
  • Ignoring Directories: If you want the scanner to skip certain directories, you can define them in the CI/CD configuration under variables:

Variables:

  IAC_PATHS: “infrastructure/*,!infrastructure/legacy/”

In the above, the scanner will only analyze files within the infrastructure directory and will exclude the legacy sub-directory.

4. Running the Scan

Once the configuration is set, initiate a CI/CD pipeline run. The IaC Scanning job will analyze your Infrastructure as Code files and provide insights into potential vulnerabilities.

5. Reviewing Results

Post-analysis, the vulnerabilities (if any) will be visible:

  • Within the merge request (if the scan was triggered by one).
  • In the Security & Compliance section of your project.

Here you can:

  • See details of the vulnerability.
  • Mark it as resolved or create an issue to track it.
  • Optionally, set up automated actions based on vulnerability severity or type.

Best Practices for Secure IaC (Infrastructure as Code) Configuration

Best Practices for Secure IaC (Infrastructure as Code) Configuration are –

  1. PoLP Principle (The Principle of Least Privilege)
  2. Maintain Version Control and Change Tracking
  3. Regularly Scanning and Updating Dependencies
  4. Protect Secrets
  5. Efficiently Validate and Evaluate Configurations

1. PoLP Principle (The Principle of Least Privilege)

The Principle of Least Privilege is an essential security concept designed to ensure entities (be they users, systems, or processes) receive only those privileges necessary to perform their tasks and nothing more. This principle becomes even more essential in IaC environments with permissions that can be assigned programmatically; when given incorrectly or too broadly, they could expose resources to unnecessary risk.

Adherence to PoLP requirements within IaC requires carefully scripting permissions so each service or function only accesses resources they require – for cloud infrastructures like AWS, this could involve giving read-only permission for S3 bucket rather than blanket permission for all storage resources; ongoing review of IaC scripts to make sure permissions stay tight as infrastructure evolves.

2. Maintain Version Control and Change Tracking

Version control isn’t only necessary in traditional software development; it also plays an essential part in infrastructure management in an IaC environment. Tracking changes, rolling back configurations, and understanding infrastructure adjustments is vital in maintaining a secure and stable environment for IaC infrastructure management.

GitLab and GitHub platforms for IaC configuration provide not only change tracking tools but also collaborative features to review proposed modifications with team members before being deployed into production environments. This peer review process ensures security concerns are considered and compliance with best practices before any significant modifications are introduced into IaC environments.

3. Regularly Scanning and Updating Dependencies

As with software development, infrastructure as code (IaC) configurations often rely on third-party templates and modules from third parties to streamline infrastructure deployment; while such dependencies can make deployment simpler, they also present potential vulnerabilities if outdated or compromised.

Constantly scanning dependencies helps ensure no known security vulnerabilities are being introduced into infrastructure, with special tools designed for this task automatically flagging outdated or vulnerable modules and prompting teams to update them as required – much like software patch management but applied specifically to infrastructure modules in order to achieve maximum protection and resilience.

4. Protect Secrets

The digital landscape is littered with warning stories about secrets being exposed that lead to severe breaches. IaC’s programmatic nature makes it tempting for programmers to hard code sensitive information directly into scripts – an irresponsible practice that should always be avoided.

Organizations should avoid embedding secrets directly within IaC scripts by instead employing dedicated secret management solutions like HashiCorp Vault or AWS Secrets Manager to safeguard secrets while still remaining encrypted, thereby guaranteeing their protection even if configuration files become publically exposed.

5. Efficiently Validate and Evaluate Configurations

Ensuring IaC scripts are both functional and secure is a constant endeavor that demands regular assessment. As configurations change or the IT landscape shifts, new vulnerabilities emerge that could render previously functional scripts nonfunctional or cause them to break altogether.

Organizations should ensure their IaC configurations regularly conform with industry benchmarks and best practices to avoid this scenario, using automated testing tools for regular checks without manual intervention. Before rolling any changes out in production environments, staging or test environments are invaluable in providing early warning of any unexpected problems, helping ensure secure yet operational infrastructures in production environments.

Common Pitfalls in IaC and How to Avoid Them

Common Pitfalls in GitLab IaC Scanning and How to Avoid Them?

  1. Treating Infrastructure Code as a One-Off Script
  2. Neglect of Testing
  3. Hardcoding Secrets and Credentials
  4. Overly Complicating IaC Scripts
  5. Bypass Deprecated Tools or Libraries

1. Treating Infrastructure Code as a One-Off Script

One common misperception about infrastructure code (IaC) is treating it like any one-off script written once and rarely revisited again. Unlike one-off scripts, however, IaC requires periodic maintenance updates, revisions, and revisions like any software code.

How to Prevent: Conduct regular code reviews and updates using tools such as GitLab IaC Scanning to scan IaC configurations continuously – this ensures your code stays up-to-date, relevant, and free of potential vulnerabilities.

2. Neglect of Testing

Some teams rushing to deploy may skip thorough IaC script testing in favor of moving quickly – believing if something runs, everything’s fine – which may result in unexpected behavior or security vulnerabilities in their provisioned infrastructure. This oversight may leave unexpected behaviors unaccounted for or create security holes requiring immediate patching upon deployment.

How to Prevent: As with application code, testing IaC configurations in non-production environments such as staging is essential in avoiding production environment misconfigurations and potential pitfalls; GitLab IaC Scanning provides an essential service here that allows teams to identify any misconfigurations before impacting production environments directly.

3. Hardcoding Secrets and Credentials

Hardcoding can be an obvious pitfall in IaC scripts and should always be avoided to protect data security. By embedding secrets or credentials directly within their code, hardcoded secrets or credentials may pose substantial security threats that should not be neglected.

How to Prevent: Instead of directly including secrets in scripts, use dedicated secret management tools. GitLab IaC Scanning tools may detect such practices by scanning for them as part of their scanning process, such as alerting developers about any hardcoded credentials within their configuration files.

4. Overly Complicating IaC Scripts

As they attempt to craft one solution that covers every possible scenario, some engineers become over-complicated when writing IaC scripts. While this might cover various situations more efficiently, it also creates unnecessary complications and potential points of failure in their IaC solutions.

How to Prevent: Prioritise simplicity and clarity by breaking up complex configurations into manageable modules using GitLab IaC Scanning; regularly inspect these modules using GitLab IaC Scanning so they remain effective, secure, and functional.

5. Bypass Deprecated Tools or Libraries

IaC frequently relies on third-party tools or libraries; however, as these external resources develop, they may deprecate certain features or functions. using outdated methods could present both functional and security vulnerabilities.

How to Prevent: Keep an active watch over any third-party tools or libraries your IaC configurations depend upon, regularly updating scripts to reflect updated versions and recommendations, as well as using scanning tools like GitLab IaC Scanning that highlight outdated functions or dependencies.

See SentinelOne in Action

Discover how AI-powered cloud security can protect your organization in a one-on-one demo with a SentinelOne product expert.

Get a Demo

Conclusion

GitLab IaC scanning can detect security gaps and handle dependencies. You can eliminate false positives, set custom rules, and maintain audit trails. It also makes reporting a lot more convenient and you can easily integrate GitLab IaC scanning into your CI/CD pipeline for best results. Protect secrets, maintain version control and change tracking, and apply the Principle of Least Privilege Access with the GitLab IaC scanner. It will help you efficiently evaluate and manage your configurations for smooth infrastructure management.

GitLab IaC Scanning FAQs

GitLab IaC Scanning is a built-in CI/CD feature that examines your Infrastructure as Code files—like Terraform, CloudFormation, Ansible, Dockerfiles, and Kubernetes manifests—for misconfigurations and known vulnerabilities. It runs during the test stage of your pipeline, produces JSON-formatted SAST reports, and highlights issues in merge requests so you can fix risky settings before deployment.

IaC Scanning debuted in GitLab 14.5, released in June 2021. From that version onward, any supported IaC configuration files in a project automatically trigger the appropriate KICS-based analyzers during CI pipelines, provided you include the IaC template in your .gitlab-ci.yml

GitLab’s IaC Scanning supports a wide range of configuration files, all powered by KICS:

  • Ansible playbooks
  • AWS CloudFormation (YAML/JSON)
  • Azure Resource Manager (JSON)
  • Dockerfiles
  • Google Deployment Manager
  • Kubernetes manifests
  • OpenAPI definitions

Terraform HCLIf you use Bicep, compile to JSON before scanning, and note that custom registry Terraform modules aren’t scanned yet .

All IaC Scanning analyzers in GitLab rely on KICS (Keep It Configuration Scanner), an open-source engine that checks your IaC files against a rich rule set. KICS automatically detects supported formats and applies the appropriate checks, and you can customize, disable, or pin rule versions via CI variables or custom rule directories .

To enable IaC Scanning, add the official template to your project’s .gitlab-ci.yml at the top:

add the line:

  - template: Jobs/SAST-IaC.gitlab-ci.yml

This injects an iacs job in the test stage. On GitLab.com or self-managed with shared runners, no extra runner setup is needed. After a pipeline runs, scan results appear as job artifacts, in merge requests, and under Security & Compliance .

Discover More About Cloud Security

What is Cloud Security?Cloud Security

What is Cloud Security?

Cloud security continuously monitors and protects your cloud services and assets. It identifies vulnerabilities, enforces controls, and defends proactively. Learn more.

Read More
What is the Cloud Shared Responsibility Model?Cloud Security

What is the Cloud Shared Responsibility Model?

The cloud shared responsibility model defines security roles. Explore how understanding this model can enhance your cloud security strategy.

Read More
What is Kubernetes?Cloud Security

What is Kubernetes?

Kubernetes is a powerful orchestration tool for containers. Explore how to secure your Kubernetes environments against potential threats.

Read More
What is GKE (Google Kubernetes Engine)?Cloud Security

What is GKE (Google Kubernetes Engine)?

Google Kubernetes Engine (GKE) simplifies Kubernetes management. Learn best practices for securing applications deployed on GKE.

Read More
Your Cloud Security—Fully Assessed in 30 Minutes.

Your Cloud Security—Fully Assessed in 30 Minutes.

Meet with a SentinelOne expert to evaluate your cloud security posture across multi-cloud environments, uncover cloud assets, misconfigurations, secret scanning, and prioritize risks with Verified Exploit Paths™.

Get Cloud Assessment
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • English
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2025 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use