Grundsätzlich immer ein guter Workflow, über den man natürlich nachdenken muss. Wie prüfe ich gefixte Security Issues in einer Regression?

Diese Frage hatte ich mir schon 2021 gestellt und hier die damaligen Informationen zusammengefasst.

Owasp Zap: Security Regression Testing mit OWASP ZAP

Sicher ist, dass ihre ZAP verwenden könnt, um Sicherheitsregressionstests für eure eigenen Produkte durchzuführen. Dazu diese Informationen aus 2021.

  • Using the ZAP Desktop

    The user can select specific alerts they wish to retest by selecting them in the Alerts Tab, or via clicking on the retest menu option and choosing the required alerts from the Retest dialog that appears(they can filter the alerts on the basis of the sites). They can choose to then click on retest and see the retest results in the dialog itself, or they can click on the “Generate Retest Plan” button in order to generate a retest plan, which could be used in the future. They can also load a previous retest plan from the retest dialog via the use of the “Load Retest Plan” button. Note that a retest plan can only be generated when the session is in memory, and that once a session is persisted, the alerts present in the session cant be retested anymore. However,a stretch goal of my project would be to allow the generation of retest plans from saved sessions as well.

  • Using the command line

    The user can also automate the retesting of alerts via the use of the Automation Framework, by simply using the retest plan as the configuration file to be provided to the -autorun option.

Grundsätzlich muss Java und ZAP installiert sein, um entsprechende Test durchzuführen. Das soll aber durchaus schon klar sein, und wie man Owasp Zap installiert und einrichtet, findet ihr hier:

Um ZAP von einem Java-Programm aus zu starten, könnt ihr etwa so vorgehen:

ProcessBuilder pb = new ProcessBuilder("/home/myuser/fullpath/ZAP 2.9.0/zap.sh");  // full path to script, use zap.bat on Windows
pb.directory(new File("/home/myuser/fullpath/ZAP 2.9.0/"));  // directory where the script is in
Process p = pb.start();

Beachtet, dass dadurch die vollständige Benutzeroberfläche angezeigt wird, was für erste Tests nützlich ist. Um es im Hintergrund zu starten, gebt “-daemon” als Argument im Skript an. Natürlich gibt es Äquivalente in anderen Sprachen – ihr müsst nur das entsprechende Skript (zap.sh oder zap.bat) ausführen und das Arbeitsverzeichnis auf den Ort des Skripts entsprechend einstellen.

Als Nächstes führt Ihr Unit-Tests mithilfe von ZAP aus. Anschließend können ihr ZAP über die ZAP-API steuern, z. B. für Spidering oder Active Scan.

Wie man Security Regression Test in eine CI-Pipeline einbindet werde ich in einem weiteren Artikel erklären.