Back to Blog
Engineering12 min read

Reproducible Scans for CI: Pentestas YAML Config in Anger

P

Pentestas Team

Security Analyst

5/5/2026
Reproducible Scans for CI: Pentestas YAML Config in Anger
TL;DR · Key insight

Dive into the intricacies of Pentestas' YAML configuration for reproducible scans within CI pipelines. Explore how this powerful feature integrates with GitHub Actions to streamline your security testing workflow.

Introduction to YAML Configuration for CI

In the fast-paced world of continuous integration and continuous deployment (CI/CD), ensuring that security scans are reproducible is paramount. Reproducible scans guarantee that the results are consistent across different environments and timeframes, allowing teams to confidently act upon identified vulnerabilities. This is particularly crucial in automated pipelines where reliability and accuracy are non-negotiable. By embedding security checks into the CI/CD pipeline, organizations can catch vulnerabilities early, reducing the risk of deploying insecure code.

YAML configurations have become a cornerstone in modern software development, providing a human-readable format to define complex configurations. These files describe how applications should be built, tested, and deployed across various environments. YAML's simplicity and flexibility make it an ideal choice for managing CI/CD tasks. In the context of Pentestas, YAML files help define the parameters and workflows for automated pentesting, enabling seamless integration into existing development processes.

At Pentestas, we leverage YAML to streamline pentesting workflows, ensuring that each scan is executed with precision. Our YAML configuration files allow us to specify targets, scan types, and even schedule regular assessments. By doing so, we automate the mundane and focus on what truly matters: identifying and mitigating security risks. Here is a sample YAML snippet that demonstrates how we configure a basic pentesting task:

version: '1.0'
targets:
  - "http://example.com"
scan:
  type: "full"
  schedule: "weekly"
notifications:
  email: "security@example.com"

This configuration outlines a weekly full scan targeting http://example.com, with notifications sent to the security team. The beauty of this approach lies in its reproducibility and ease of modification, empowering teams to adapt quickly to new security challenges.

Understanding the scan.yaml Schema

The scan.yaml file is the cornerstone of our CI scanning configuration, dictating how scans are executed within the Pentestas framework. This YAML file consists of several key sections, each serving a distinct purpose. At the top level, the file declares its version, ensuring compatibility with our platform. The main body is composed of sections for targets, authentication, and options, all of which are essential for accurate and reproducible scans.

The targets section specifies the endpoints to be scanned, which can be defined as either individual URLs or broader wildcard entries. For example:

targets:
  - https://api.example.com/v1/*
  - https://www.example.com/login

The authentication section handles credential provisioning for the scans, crucial for accessing protected endpoints. This can include API keys, bearer tokens, or basic auth details. Finally, the options section provides additional flexibility, allowing us to tailor scan parameters like timeout settings and concurrency limits to better fit our CI workloads.

To ensure configurations are valid and consistent, our system performs schema validation on the scan.yaml file. This process checks for required fields and correct data types, preventing misconfigurations that could lead to inefficient or failed scans. For instance, if a numeric value is expected in a field but a string is provided, the validation process will flag it, ensuring that the file aligns with the expected schema before any scanning activity begins.

Defining Login Flows with login_flow Steps

Automating login processes during penetration testing is a critical aspect of ensuring the accuracy and consistency of our scans. Manual login is not only time-consuming but also prone to errors, especially when dealing with complex authentication systems. By defining login flows in our scan.yaml file, we can streamline the authentication phase, allowing our tests to run smoothly in CI environments. This automation ensures that our scans are reproducible across different environments, enabling us to detect vulnerabilities effectively without the noise of false positives caused by authentication failures.

The login_flow steps in the scan.yaml file are structured to accommodate a variety of authentication mechanisms. Each step in the flow is designed to handle a specific part of the login process, such as entering a username, password, and handling multi-factor authentication if needed. These steps are configured using a YAML-based syntax, which allows for a clear and concise representation of the login sequence. This approach not only simplifies the setup but also provides a single source of truth for authentication procedures across different test environments.

login_flow:
  - step: "open_url"
    url: "https://example.com/login"
  - step: "fill_form"
    form_id: "loginForm"
    fields:
      username: "admin"
      password: "{{ PASSWORD }}"
  - step: "submit_form"
    form_id: "loginForm"
  - step: "check_page"
    url_contains: "/dashboard"
    success_message: "Login successful!"

Typical authentication scenarios we encounter include simple form-based logins, OAuth-based flows, and even more complex setups involving CAPTCHAs or 2FA. In our scan.yaml, we can define these flows by combining steps like open_url, fill_form, and submit_form. For instance, handling OAuth might involve redirect handling and token retrieval, while integrating a CAPTCHA solution could use predefined tokens for testing environments. These configurations ensure that our scans are thorough, covering all potential entry points in the authenticated areas of the application.

Rules to Avoid and Focus with rules_avoid/focus

When configuring scan rules within the Pentestas YAML, the rules_avoid and rules_focus directives are essential for tailoring the scope of your scans. These rules allow us to specify which tests should be included or excluded, enhancing the relevance of the scanning process. For instance, if your application is not susceptible to SQL injection due to the use of an ORM, you can exclude this test by adding it to rules_avoid. This not only speeds up the scan but also reduces noise in the results.

Customizing scan focus is particularly useful in continuous integration environments where build times are critical. Consider a scenario where development is primarily concentrated on authentication mechanisms. You can use rules_focus to prioritize tests related to password policies and session management. This ensures that any vulnerabilities in these areas are caught early and addressed promptly. Additionally, focusing on specific areas reduces unnecessary alerts from less relevant vulnerabilities, allowing developers to concentrate on what matters most.

scan:
  rules_avoid:
    - SQLInjection
    - CrossSiteScripting
  rules_focus:
    - Authentication
    - SessionManagement

The impact on scan efficiency and accuracy is significant when utilizing these directives effectively. By avoiding irrelevant tests, the system resources are better utilized, leading to faster scan times. This is crucial in CI environments where every second counts. Furthermore, by focusing the scans, the results are more actionable, as developers receive fewer false positives. This leads to quicker turnaround times in addressing vulnerabilities, ultimately improving the overall security posture of the application. The flexibility provided by rules_avoid and rules_focus is invaluable for maintaining efficient and effective security practices within agile development workflows.

Integrating with GitHub Actions

Integrating Pentestas with GitHub Actions allows us to seamlessly incorporate security scans into our CI/CD pipeline. To set up Pentestas in a GitHub Actions workflow, we need to create a workflow YAML file in the .github/workflows directory of our repository. This file specifies when and how the scans are triggered. A typical configuration runs a scan on every push or pull request to the main branch, ensuring that our code remains secure at each stage of development.

name: Pentestas Scan

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  run-pentestas:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Run Pentestas
      run: |
        curl -sSL https://install.pentestas.io | bash
        ./pentestas scan --config .pentestas.yaml

Automating scans enhances our CI/CD process by providing immediate feedback on security vulnerabilities. Once the workflow is configured, every code change triggers a Pentestas scan. The results are logged in the workflow run summary, making it easy to identify and address issues. This automation helps in maintaining the security hygiene of the codebase, as developers are alerted to vulnerabilities before code merges into production. The scans can be customized to suit the project’s needs, such as targeting specific directories or excluding certain files.

Effortless Notifications

Handling scan results and notifications is streamlined through GitHub Actions. By integrating GitHub's notification system, developers can receive alerts directly in their pull request threads or via email. This ensures that security issues are not overlooked and are addressed promptly.

The integration with GitHub Actions also supports configuring custom notifications. We can set up alerts for specific vulnerability types or severity levels, ensuring that critical issues are prioritized. This flexibility is crucial for maintaining an agile and responsive development workflow. By leveraging GitHub's native capabilities, Pentestas provides a robust solution for continuous security monitoring, aligning perfectly with modern DevSecOps practices.

Best Practices for YAML Configuration

When crafting your scan.yaml files, it’s crucial to be aware of common pitfalls. One frequent issue is misaligned indentation, which can lead to unexpected parsing errors. To avoid this, use spaces consistently, preferably two or four spaces per level. Another common mistake is mistyping keys, which YAML won’t necessarily flag. Implementing a linter in your CI pipeline can catch these errors early. Additionally, ensure that all paths are valid and accessible to prevent runtime errors during scans.

Maintaining clarity and conciseness in YAML configuration is essential for readability and ease of maintenance. Begin by grouping related configuration settings together and provide comments where necessary, explaining complex configurations. For instance, when defining a scan with multiple parameters, organize them logically:

scan:
  name: "weekly_security_check"
  schedule: "0 0 * * 0" # Every Sunday
  targets:
    - url: "https://example.com"
      env: "production"
  options:
    - threads: 5
    - timeout: 60

Version control is another critical aspect of managing scan.yaml files effectively. Treat them as code by placing them under version control systems like Git. This allows you to track changes over time, revert to previous configurations when necessary, and collaborate seamlessly with team members. Use descriptive commit messages that explain the purpose of changes, such as "Updated scan targets to include new endpoints". Creating branches for large changes can also facilitate code reviews and ensure quality before merging into the main configuration.

Case Study: A Real-World Implementation

In this case study, we examine the implementation of reproducible scanning within a medium-sized e-commerce organization. The company, dealing with millions of transactions annually, faced critical challenges in maintaining a robust security posture. Their primary concern was ensuring that vulnerability scans could be consistently reproduced across different environments and stages of their CI/CD pipeline. Additionally, the organization aimed to minimize false positives and reduce the overall time spent on manual security checks, which previously delayed deployment cycles.

To address these challenges, the organization adopted Pentestas' YAML configuration files to standardize their scanning processes. By defining consistent scanning parameters and rules, they ensured that every scan was reproducible and reliable. Here is an example of a YAML configuration they used:

scan:
  targets:
    - url: "https://staging.example.com"
  rules:
    - name: "SQL Injection"
      enabled: true
    - name: "Cross-Site Scripting"
      enabled: true

The implementation of these configurations resulted in several notable improvements. The organization observed a 40% reduction in false positives, which significantly reduced the time security teams spent on triaging and verifying issues. Moreover, the standardized process allowed for quicker feedback loops, empowering developers to address security vulnerabilities earlier in the development cycle. This case study highlights how a structured approach to reproducible scans can enhance an organization's security posture, streamline processes, and ultimately lead to more secure software delivery.

Limitations and Future Developments

While our YAML configuration offers a streamlined approach to setting up reproducible scans in CI environments, it is not without its limitations. One of the primary challenges lies in its verbosity; complex configurations can become cumbersome and difficult to manage. Additionally, the current version of our YAML parser has limited support for conditional logic, which can impede the ability to create dynamic scanning pipelines. For example, users currently cannot easily incorporate conditional execution based on scan results from previous stages directly within the YAML file.

Looking ahead, we are actively working on several enhancements to address these limitations. Our roadmap includes introducing support for if-else logic within YAML files, which will allow for more flexible and adaptive scan configurations. We are also exploring the integration of more comprehensive documentation directly within the YAML files themselves, enabling better self-documenting configurations. These updates aim to make our platform more user-friendly while maintaining its powerful scanning capabilities.

scans:
  - name: "Full Security Scan"
    steps:
      - run: "nmap -sV -oN output.txt 192.168.1.1"
      - if: "scan_success"
        run: "grep 'open' output.txt | awk '{print $1}'"
      - else:
        run: "echo 'Scan failed, retrying...'"

Community feedback has been invaluable in shaping the direction of our development efforts. We continuously engage with users through forums, surveys, and direct feedback channels. This interaction has highlighted key areas for improvement and innovation. For instance, several users have requested more granular control over error handling and retry logic within YAML configurations, which we have prioritized in our upcoming releases. We are committed to fostering an open dialogue with our community to ensure that Pentestas evolves in ways that genuinely meet their needs.

Try it on your stack

Free tier includes 10 scans/month on a verified domain. No credit card required.

Start scanning

Why this matters when buying pentesting-as-a-service

Pentestas is a pentesting-as-a-service offering — an AI penetration testing system that scans web apps, APIs, mobile binaries, cloud accounts, and internal networks under one platform. We default to penetration testing with Claude for triage and exploit-chain narration, and switch to penetration testing with DeepSeek for cost-sensitive bulk passes; both modes go through the same accuracy gate, the same destructive-payload guard, and the same reporting pipeline so a B2B SaaS pentest you run today and one you run six months from now produce comparable, auditable results.

If you've previously bought one-off engagements and you're comparing them against penetration testing with AI, the trade-offs in this post are the ones to read against your last consulting report.

Alexander Sverdlov

Alexander Sverdlov

Founder of Pentestas. Author of 2 information security books, cybersecurity speaker at the largest cybersecurity conferences in Asia and a United Nations conference panelist. Former Microsoft security consulting team member, external cybersecurity consultant at the Emirates Nuclear Energy Corporation.