Skip to content
Automate Security Fit walkthrough
Back to the blog

April 10, 2026 / Automate Security

AI-Assisted Penetration Testing for DevOps: What to Automate and What to Verify

A practical way to place security tests in CI/CD while keeping authorization, finding review, and retesting with the engineering team.

AI-Assisted Penetration Testing for DevOps: What to Automate and What to Verify

Put the security question before the pipeline job

A deployment pipeline can run checks repeatedly. That is useful, but repetition does not establish that a test reached the vulnerable behavior or that a finding is exploitable. Before adding a security job, name the application or API, the environment, the user roles that matter, and the decision the result should support. A pull request check might prevent a known dependency from entering a build. A release test might need authenticated access to verify a workflow. A deeper assessment may need a separate testing window and explicit authorization.

The OWASP DevSecOps Guideline treats repository scans, software composition analysis, static analysis, infrastructure scanning, API security, and dynamic testing as distinct activities that can be added progressively. Pick the checks that correspond to your architecture and risk. Running every available scanner on every commit can create noise without answering the team's question.

An automated vulnerability scan and a penetration test answer different questions. A scanner can repeatedly look for known patterns or test a defined set of requests. A penetration test also examines how a person might combine behaviors, cross trust boundaries, and misuse business logic within an authorized scope. Automation can support that assessment, but the presence of an AI agent does not establish that those human judgments occurred. Ask a provider to identify which activities were automated, which were reviewed by a tester, and which paths were outside scope.

Decide which checks belong at each stage

At a pull request, fast checks can inspect source, dependencies, secrets, and infrastructure definitions before a change is merged. Record the repository and commit tested so a finding can be reproduced. If a policy check fails, show the exact file or resource and the rule involved. Let the team document a justified exception with an owner and an expiry, rather than silently suppressing the result.

In a test environment, dynamic and API checks can exercise running behavior. The test needs a defined target, representative roles, and appropriate test accounts. An anonymous request cannot establish what an ordinary user or administrator can reach behind authentication. The OWASP API Security Top 10 describes access-control failures, including object-level authorization, that require more than a generic unauthenticated probe.

Production testing needs a separate decision. Confirm allowed methods, rate limits, a responsible contact, and a stop procedure before a test can affect a live service. Keep real credentials and sensitive responses out of ordinary CI logs. The OWASP Web Security Testing Guide is a reference for choosing test areas; it is not proof that a particular automated job covers them all.

Write a test plan the team can actually run

Start with an inventory of application endpoints and the roles that use them. Pick one high-value workflow, such as viewing an account record or changing an access setting. Describe the expected authorized behavior and an unauthorized variation. For an API that accepts an object identifier, test whether a user in one account can access another account's object; this maps to the object-level authorization risk in the OWASP API Security Top 10. Use test accounts and non-sensitive data so the team can inspect evidence safely.

Then define the execution boundary. Record the hostnames and environments allowed, the accounts and roles supplied, the request rates, excluded actions, permitted testing hours, and the person who can stop a run. Decide what constitutes success or failure before looking at tool output. A request that returns an error is not automatically evidence of a security weakness; the result must be interpreted against the application's intended authorization and data rules.

For CI/CD, use a staged schedule. Cheap, deterministic checks can run on each pull request. Authenticated dynamic tests may be more suitable for a deployed test environment after a build. A deeper assessment can occur before a significant release or architectural change. Keep the test configuration versioned with the target commit so a later result can be compared with the same scope. If a new endpoint or role appears, update the inventory and tests; a green result from yesterday's narrower scope does not cover it.

Where AI can help, and where it cannot decide

An AI-assisted tool may group similar findings, suggest test cases, explain an unfamiliar code path, or draft a possible fix. Treat those outputs as leads for investigation. The reviewer still needs to establish the affected path, the role and environment used, the evidence, and the likely impact. Generated code needs normal tests and an engineer's merge decision.

This distinction matters when a tool reports a dramatic improvement in speed or false positives. Ask for a measured comparison using your own target and definition of a valid finding. A percentage from another vendor or environment cannot tell you whether your authenticated paths were reached. Useful measures include the proportion of findings engineers could reproduce, time spent on triage, and the number of agreed issues that passed a specific retest. Count exceptions and untested paths too.

An AI-generated fix deserves the same review as any other code change. Read the diff and identify which behavior it changes. Run the functional tests that protect the legitimate workflow and a security regression test for the reported issue. A patch that merely suppresses the scanner, changes a status code, or blocks a test account without correcting the authorization rule has not resolved the underlying problem.

Make the result part of the engineering record

For each actionable issue, retain the target and environment, the affected request or workflow, the test method, the finding evidence, the fix owner, and the retest result. Link the evidence to the change that addressed it. A passed retest describes that issue in that environment at that point in time; it does not certify the entire application.

A practical first implementation is deliberately narrow:

  • Choose one application or API and one release decision.
  • Add one fast check to the pull request path and one authorized behavior check to a test environment.
  • Review every reported high-impact finding with an engineer before treating it as resolved or false.
  • Record an explicit retest after a fix and keep the method with the result.
  • Expand coverage only after the first loop produces evidence the team can use.

The NIST Secure Software Development Framework calls for security practices to be integrated into the development process. The point of automation is to make those practices repeatable and reviewable, with people still responsible for scope, evidence, and changes.

Common questions before adding AI-assisted testing

Is it safe to run an automated penetration test in production?

Only after an owner authorizes a specific scope and the team has assessed the effects of the chosen methods. Even non-destructive probes can create load, alter records, trigger lockouts, or expose sensitive responses in logs. Use a representative test environment for routine checks where possible. If production is necessary, document rate limits, excluded actions, monitoring, an escalation contact, and a stop procedure. The OWASP Web Security Testing Guide helps select tests; it does not replace authorization or an operating plan.

What should be automated first?

Choose a recurring decision that already has an owner. For many teams, source and dependency checks provide a manageable first pull-request step, while one authenticated workflow test gives better behavior evidence than a broad unauthenticated crawl. The right first test depends on the system's risk and the team's ability to investigate a failure. Record what is covered before expanding to more scanners.

When should a finding block a merge?

A block needs a known rule, reproducible evidence, an identified owner, and a documented exception path. For a high-impact finding whose effect is still uncertain, a short human review may be more useful than an unexplained permanent gate. Once the issue is confirmed, link the fix and retest to the same target and role. A passing check should mean that the defined test passed, not that the application is generally secure.

Get launch and security updates Get updates

Choose the launch news or practical security notes you want.

Choose one or both. You can unsubscribe at any time. Privacy details.

Your email choices are saved.

We’ll send only the updates you selected.