Stay Updated with the Latest in Cybersecurity & Tech. Explore Anosion ↗

How to Run OWASP ZAP Baseline Scans with Docker

Learn how to run OWASP ZAP Baseline Scan with Docker, interpret passive-scan alerts, and add safer web security checks to CI/CD.

Web application security testing does not always require an aggressive vulnerability scan. Many teams can benefit from a repeatable first-pass assessment that identifies potential security weaknesses without deliberately attacking the target application.

The OWASP Zed Attack Proxy (ZAP) provides a Baseline Scan designed for this purpose. It uses Docker to run a time-limited web crawl, followed by passive analysis of the HTTP messages observed during the scan.

This makes ZAP Baseline Scan useful for development workflows, scheduled security checks, and continuous integration and continuous delivery (CI/CD) pipelines.

However, a baseline scan is not a complete penetration test. Understanding its capabilities and limitations is essential before relying on its results.

What Is OWASP ZAP Baseline Scan?

OWASP ZAP is an open-source web application security testing tool. It can inspect HTTP traffic, explore web applications, and identify potential security issues through different scanning approaches.

The Baseline Scan is a specific, packaged scanning workflow available in ZAP's Docker images.

According to the official ZAP documentation, the baseline workflow runs the spider against a target for a limited period—one minute by default—and then waits for passive scanning to finish.

Passive scanning analyzes requests and responses observed during browsing. It does not deliberately modify requests to exploit vulnerabilities.

Depending on the application and the rules triggered, the scan may report issues involving security headers, cookie attributes, information exposure, and other observable security concerns.

The important distinction is that a passive alert is evidence of a potential issue, not automatic proof of an exploitable vulnerability.

When Should You Use It?

ZAP Baseline Scan is particularly useful when you need to:

  • Establish a repeatable baseline for a web application's security posture.

  • Identify potential configuration and response-level weaknesses.

  • Run preliminary security checks in a CI/CD pipeline.

  • Generate reports that developers can review and track over time.

  • Recheck an application after deployment or configuration changes.

It is less suitable as the only security test for applications with complex authentication, substantial client-side rendering, or business logic that requires specialized testing.

Prerequisites

Before starting, prepare the following:

  • Docker installed and running on your system.

  • Network access to the target application.

  • Permission to test the target host and the routes the scanner may visit.

  • A browser or HTML report viewer for reviewing the output.

You do not need to install the full ZAP desktop interface to use the packaged Docker scan.

For the examples below, use a local test application or a staging environment that you control. Before scanning a production system, confirm that the scope and expected traffic are approved.

Step 1: Run a Baseline Scan with Docker

The simplest way to launch the baseline scan is to run the official ZAP Docker image.

Execute the following command in a terminal:

docker run --rm -t \
  ghcr.io/zaproxy/zaproxy:stable \
  zap-baseline.py \
  -t https://your-authorized-test-host.example

Replace https://your-authorized-test-host.example with the URL of your authorized test environment.

The command uses the following options:

  • docker run starts a container.

  • --rm removes the container after it exits.

  • -t allocates a terminal for readable command output.

  • ghcr.io/zaproxy/zaproxy:stable selects the stable ZAP image.

  • zap-baseline.py invokes the baseline scan script.

  • -t followed by the URL specifies the scan target.

The first Docker run may take longer because the image must be downloaded if it is not already available locally.

The scanner then explores accessible application content and performs passive analysis. The total runtime depends on the application, network conditions, crawling behavior, and the time needed for passive scanning.

Do not interpret the default one-minute spider duration as a guarantee that every page or application feature will be discovered.

Step 2: Generate an HTML Report

Terminal output is useful for quick checks, but an HTML report is more convenient for documentation and review.

Create a directory for the reports and run:

mkdir -p zap-reports

docker run --rm -t \
  -v "$(pwd)/zap-reports:/zap/wrk/:rw" \
  ghcr.io/zaproxy/zaproxy:stable \
  zap-baseline.py \
  -t https://your-authorized-test-host.example \
  -r baseline-report.html

This command mounts the local zap-reports directory into the container's /zap/wrk/ directory. The -r option requests an HTML report named baseline-report.html.

After the scan finishes, look for the report at:

zap-reports/baseline-report.html

Open the report in a browser and review the alert details.

Keep generated reports in an appropriate location. They may contain target URLs, request details, and other information that should not be exposed publicly.

Step 3: Understand the Scan Results

ZAP reports alerts with details that help explain what was observed and why it may matter.

A useful triage process considers at least four elements.

Alert name and description

Read the full alert description rather than relying only on its title. Determine which request, response, header, cookie, or other observation triggered the rule.

Evidence and affected URL

Inspect the reported evidence and URL. Establish whether the finding affects an important application route, a shared response, or a low-impact resource.

Be careful when sharing evidence: request and response details can contain sensitive data.

Risk and confidence

Risk describes the potential security impact, while confidence reflects how certain the scanner is about its finding.

Neither is a substitute for validation. A high-risk alert still needs investigation, and a low-confidence alert should not be dismissed without considering its context.

Reproducibility

Repeat the relevant observation when appropriate. Compare the response with the application's intended configuration, review server settings, and determine whether the behavior is genuinely problematic.

For a structured workflow, see Anosion's related guide, How to Validate a Vulnerability Finding Without False Positives.

Step 4: Configure Alert Handling

The baseline scan reports alerts as warnings by default. A configuration file can change individual rules to informational, ignored, or failing states.

Generate a starting configuration with:

docker run --rm -t \
  -v "$(pwd)/zap-reports:/zap/wrk/:rw" \
  ghcr.io/zaproxy/zaproxy:stable \
  zap-baseline.py \
  -t https://your-authorized-test-host.example \
  -g /zap/wrk/gen.conf

Review the generated file and the current official documentation before using it as a policy. Do not assume that every generated rule requires the same treatment.

For recurring scans, distinguish between:

  • Confirmed issues that require remediation.

  • Findings that need further investigation.

  • Accepted risks with documented justification.

  • Rules that are not applicable to the application.

Avoid suppressing an alert merely because it appears repeatedly. Record the reason, scope, owner, and review conditions for any exception.

A rule configuration can help control reporting behavior, but it does not fix the underlying security issue.

Step 5: Add Baseline Scanning to CI/CD

A baseline scan can be integrated into a CI/CD workflow so that the team receives repeatable security feedback as the application changes.

For GitHub Actions, OWASP ZAP maintains an official action for running baseline scans.

The following example illustrates the basic setup:

name: Web Security Baseline

on:
  workflow_dispatch:

jobs:
  zap-baseline:
    runs-on: ubuntu-latest

    steps:
      - name: Run OWASP ZAP Baseline Scan
        uses: zaproxy/action-baseline@v0.15.0
        with:
          target: ${{ vars.STAGING_URL }}

Before using this workflow:

  1. Configure STAGING_URL as a repository or organization variable containing the authorized staging URL.

  2. Confirm that the runner can reach the target.

  3. Review the official action's current documentation and permissions requirements.

  4. Decide how reports and findings should be retained and assigned.

  5. Test the workflow against a known, controlled environment before relying on it for release decisions.

The example uses a manually triggered workflow to avoid introducing an automatic scan on every push before the scope and operating behavior have been reviewed.

The action also supports additional configuration for report handling and alert policies. Its behavior should be reviewed against the version pinned in the workflow.

Do not automatically fail a release whenever any alert appears without first designing a defensible triage policy. Conversely, do not treat a successful workflow run as proof that the application is secure.

Step 6: Establish a Repeatable Review Process

Running a scanner is only one part of a security workflow. Findings need owners, decisions, and follow-up checks.

A practical process includes:

  1. Run the baseline scan against the approved environment.

  2. Store the report in an access-controlled location.

  3. Triage new or changed alerts.

  4. Validate findings and document the evidence.

  5. Assign confirmed issues to the responsible team.

  6. Re-run the scan after relevant remediation.

  7. Review exceptions periodically to ensure they remain justified.

Comparing reports over time can help identify changes in the application's observable security posture. However, differences between reports may also result from changes in crawling coverage, scan configuration, application state, or tool versions.

Keep those variables consistent whenever possible.

Limitations of ZAP Baseline Scan

The baseline workflow is intentionally limited. Its results should be interpreted within that scope.

It does not perform active attacks

The baseline scan's passive approach reduces the risk associated with deliberately testing exploit conditions. It does not mean that every interaction is risk-free, nor does it guarantee that the scanner will avoid every operational side effect.

Use a defined scope and monitor the application during testing.

It may not discover every route

The scanner can only analyze content it reaches and observes. Authentication requirements, JavaScript-heavy interfaces, inaccessible links, and application-specific workflows may limit coverage.

A clean report does not establish that all application routes have been tested.

It cannot prove the absence of vulnerabilities

Passive analysis is useful for identifying observable weaknesses, but it cannot reliably detect every access-control flaw, business-logic issue, injection vulnerability, or server-side implementation problem.

Additional testing methods may be necessary depending on the application's risk profile.

It requires human interpretation

Alerts can be irrelevant, incomplete, or dependent on application context. Validate important findings before making remediation or risk-acceptance decisions.

OWASP ZAP Baseline Scan vs. Full Scan

The two workflows serve different purposes.

CapabilityBaseline ScanFull Scan
Spider-based explorationYesYes
Passive scanningYesYes
Active scanningNoYes
Typical useInitial checks and routine monitoringDeeper, authorized security testing
Operational riskGenerally lower, but not zeroHigher because active tests send attack-like requests
Appropriate targetApproved environments, including carefully assessed production usePreferably a controlled test environment with explicit authorization

The full scan can probe for vulnerabilities using active tests. Such testing may affect application state, trigger security controls, or cause unintended side effects.

Choose the workflow according to the assessment objective, authorization, and operational constraints—not merely because one scan is more comprehensive.

Best Practices for Production Use

If you plan to run ZAP Baseline Scan against a production application:

  • Obtain explicit authorization and define the target scope.

  • Avoid scanning third-party systems or unrelated hosts discovered during crawling.

  • Coordinate with operations teams and establish monitoring and escalation procedures.

  • Review authentication, rate, and timeout requirements.

  • Protect reports and avoid publishing sensitive findings.

  • Keep Docker images and scanning dependencies maintained.

  • Validate important alerts before treating them as confirmed vulnerabilities.

  • Use additional testing where the application's risk and requirements justify it.

For stronger CI/CD assurance, combine baseline scanning with code review, dependency checks, secure configuration, and targeted testing of high-risk application functionality.

Conclusion

OWASP ZAP Baseline Scan provides a practical way to introduce automated web security checks without using the active attack phase of a full scan.

With Docker, teams can run repeatable assessments, produce HTML reports, and integrate checks into a CI/CD process. The value comes from combining those scans with consistent scope management, alert validation, and remediation tracking.

Most importantly, a baseline scan should be treated as an early-warning mechanism—not a security certification. A meaningful security process uses its findings to guide investigation and combines them with other testing methods to assess the application more thoroughly.

Official References

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.