Tag Archive for: loop

Posts

Agentic Scrum, Part 5 of 5: Security, Compliance and the Final Gate

 

This is part 5 of 5, the last one in the Agentic Scrum series. Part 4 covered the QA agent and the test specification. This part covers the security and compliance agent, the final gate, and how to start without betting the company.

The security and compliance agent starts as soon as code exists and runs in parallel with QA. It has one rule that sounds boring and saves a lot of trouble. It does not replace your security tools.

What the security agent does and does not do

Dependency audits, secret scanning, static analysis and license checks come from dedicated tools, because those tools are deterministic and an agent is not. If you have to follow a certain security framework like ISO 27001:2022, then this is the place where you need to provide the security controls. Best is to add here a fixed set of requirements, but don’t add OWASP, NIST or similar frameworks. Just mention them, the agent will know where to find them. Of course, if you want to be thorough or want to adapt the requirements to your company’s internal policies, you can definitely add here the exact requirements.

The agent runs them, reads their output and triages it. It separates noise from real findings, links each finding to a requirement or a control, proposes what the coding loop should fix, and writes handover 04.

It also reads the diff against security.md for things scanners tend to miss, such as a new endpoint without an access check or a log line that contains personal data. This division of labor is my approach, not a standard.

The build also produces a Software Bill of Materials (SBOM), which is attached to the handover as tool output. SBOMs are important to implement the CRA requirements.

 

The rules in security.md

# Security rules
--
## Stop the loop
Any secret in code, config or history.
Any critical finding from dependency or static analysis.
Any new dependency without a recorded license check.
Any new endpoint without an access check.
## Always record The tools run, their versions and their results. The software bill of materials of the build in CycloneDX 1.6 format (JSON). Any breach of security controls in the OWASP and NIST 800 frameworks.
Every finding with its decision: fixed, accepted with reason, or false positive. ## Never Accept a finding silently. Mark a finding as false positive without a written reason.
--

The “Stop the loop” section is what makes the agent allowed to break the loop, as described in Part 1. A secret in the repository is not a negotiation, and neither is a critical finding. The agent stops, writes down why, and the human who owns the problem gets it on the desk.

Controls as files, evidence as a by-product

Ok, I can’t control myself to not write about this, so I will just write about it. 🙂 

Compliance usually means someone assembling evidence before an audit. Here the evidence is a side effect of the process.

A mapping file in the repository ties each control to a check and to the files that prove it.

This is an excerpt, and it is a draft to verify against your own ISMS, because the numbering follows ISO 27001:2022 Annex A, where 8.25 covers the secure development life cycle, with 8.28 on secure coding and 8.29 on security testing in development and acceptance.

# ISO 27001 mapping (draft, verify against your ISMS)
--
## Secure development life cycle (Annex A 8.25)
Check: every change has value.md, requirements.md, agent-spec.md, test-spec.md.
Evidence: the spec folder and its pull requests.

## Secure coding (Annex A 8.28)
Check: guardrails/coding.md applied, CI checks green.
Evidence: handover 02 and the CI results.

## Security testing in development and acceptance (Annex A 8.29)
Check: tests written from the test spec, security tools run.
Evidence: handover 03 and handover 04.
--

The same files help with other regimes. For the EU Cyber Resilience Act, manufacturers need vulnerability handling and, in practice, a software bill of materials, and the BSI technical guideline series TR-03183 describes cyber resilience requirements for manufacturers, including SBOM requirements.

NIS2 and TISAX both want a secure development process that operates, not just one that is described. Because every change leaves its files in git, an auditor can pick any change and walk the chain from value to release.

Confirm with your auditor that this evidence format is acceptable before you rely on it.

 

The final gate

When the QA and security handovers are in, the results go to three people, and each decides something different. A developer judges technical soundness and reads the handovers for oddities, such as many loops or a huge diff. The security specialist judges risk and accepts or rejects each open finding with a written reason. The product owner judges value, which means checking the result against value.md and confirming that the “how we will know it worked” measure can actually be observed now. The decision goes into one more file.

# Final gate: invoice export
--
Decision: release
Developer: approved
Security specialist: approved, finding SEC-3 accepted (low, reason recorded)
Product owner: approved, success measure reviewed after two month-ends

—

If the answer is not release, the cause decides where the work goes back to. A missed requirement goes to requirements.md. A vague spec goes to agent-spec.md. A weak test goes to test-spec.md. A bad rule goes to the guardrails. The earliest artifact responsible gets fixed first, and everything downstream is regenerated, exactly as in Part 1.

 

Starting without betting the company

Start with one team and one low-risk feature, within the work-in-progress cap from Part 2, and run the full pipeline including every gate. Collect numbers from day one.

The four DORA metrics are deployment frequency, lead time for changes, change failure rate and time to restore.

I would add four of my own:

  • How often a spec needed rework after the agent had started,
  • how many loops the agents broke and why,
  • how many hours the product owner and developers spent per feature,
  • how many defects escaped to production.

I have no benchmarks for those last four, so your first features are the baseline.

Two warning signs are worth watching for: Approvals that arrive within minutes and never carry a comment mean the gates have turned into rubber stamps.

And agents that never break the loop mean either the specs are excellent or the agents are guessing, so check which before you celebrate.

 

Previous: Part 4, Tests Are the New Code Review. This is the last part. The whole series: Part 1, Part 2, Part 3, Part 4 and Part 5.

The post Agentic Scrum, Part 5 of 5: Security, Compliance and the Final Gate first appeared on Sorin Mustaca: Security-AI-Software.

Agentic Scrum, Part 4 of 5: Tests Are the New Code Review

This is part 4 of 5 in the Agentic Scrum series. Part 3 covered the specs and the coding loop. This part is about the QA agent and why tests carry so much weight once humans stop reading code. Part 5 closes the series with security, compliance and the final gate.

In Part 1 I made a trade: Humans no longer review generated code. The tests are what make that trade survivable, because if they are weak, nothing else stands between a plausible diff and production. That makes the quality of the test specification the critical path of the whole pipeline.

 

Where the QA agent gets its test cases

The QA agent reads agent-spec.md and requirements.md first, because they say what the feature should do. It reads the code second, only to learn names, interfaces and where behavior lives. The order matters. Tests derived from code confirm what the code does, bugs included. Tests derived from the spec confirm what we asked for. A suite written only from the code is a diary, and you want a suite that reads like a contract.

The test specification

Before any test code exists, the agent writes test-spec.md. Each case has an ID, the requirement it traces to, a type, a starting state, an action and an expected result. Here is a short excerpt for the invoice export from the earlier parts.

# Invoice export: test specification
--
TC-01 traces to R1
Type: integration
Given: a customer with 3 invoices in March
When: the user exports March in format A
Then: the file contains exactly those 3 invoices

TC-02 traces to R2
Type: integration
Given: two customers, each with invoices in March
When: customer 1 exports March
Then: no invoice of customer 2 appears in the file

TC-03 traces to F1
Type: integration
Given: a customer with no invoices in April
When: the user exports April
Then: the response says no invoices were found and no file is created

TC-04 traces to N1
Type: performance
Given: a customer with 40000 invoices in one period
When: the user exports that period
Then: the export finishes within 5 minutes

TC-05 traces to F3
Type: integration
Given: an export in progress
When: the connection drops halfway
Then: no partial file remains on the server
--

The traceability rule is simple. Every requirement ID in requirements.md has at least one case, and every case traces to a requirement or a failure mode. A small script can check this and list the gaps. It does not need an agent, and it is dull and extremely effective. A requirement with no test case is a promise nobody is checking.

Who validates the test specification

QA engineers and developers review test-spec.md in a pull request before the QA agent writes any test code. Reviewing a test spec is cheaper than reviewing test code, because the question is whether we test the right behavior, not whether the syntax is pretty. Reviewers hunt for a short list of gaps. Missing negative cases. Boundaries such as zero, one, many, the limit and one over the limit. Data variety, like names with apostrophes, time zones and empty fields. Permission cases, such as the wrong user and the right user in the wrong role. Repeated actions, like the double click. And two kinds of bad cases: those that merely restate the implementation, and those that cannot fail.

Writing the tests

After approval, the QA agent writes the tests, runs them and records the results in handover 03. The rules live in guardrails/qa.md. The sample below is short on purpose.

# QA rules
--
Use synthetic test data only. Never copy production data.
Every test carries the ID of its test case in its name.
Do not change production code. Report failures in the handover.
Quarantine a flaky test after three inconsistent runs and note it in the handover.
Never delete or weaken a test to make a run pass.
--

The separation runs both ways. The QA agent may not touch production code, and the coding agent may not touch the tests. A failing test goes back into the coding loop with a handover that names the failing case ID, so the coding agent knows exactly which promise it broke. The three-run flaky rule is an example number, so pick your own, but write it down. A flaky test left to rot teaches the whole team to ignore red.

Do the tests actually test anything

Passing tests prove little if they cannot fail. One way to check is mutation testing. A tool changes the code in small ways, for example flipping a comparison, and sees whether any test notices. Tools exist for many languages, such as PIT for Java and Stryker for JavaScript and .NET. It costs run time, so I would run it only on the changed code and treat each surviving mutant as a question for the QA engineers. I have not measured the effect, so treat it as an option and not a rule.

What humans still test

Agents test what we specified. Humans find what we did not think of. Keep exploratory testing time for the QA engineers, especially on new features.

The strange order of clicks, the double submit, the customer who uses the export for something else entirely. Every finding becomes a new case in test-spec.md, which is how the suite grows from reality instead of imagination.

 

Previous: Part 3, Write Specs a Coding Agent Can Actually Follow. Next: Part 5, Security, Compliance and the Final Gate.

The post Agentic Scrum, Part 4 of 5: Tests Are the New Code Review first appeared on Sorin Mustaca: Security-AI-Software.