PoC: Setup ZAP in the test environment to run passive checks through the activation tests #287
+211
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to introduce OWASP ZAP as a pentesting tool to perform security checks passively on the Playwright tests by using it as a proxy.
In concrete, this PoC covers checking the feasibility of adding such feature, analyzing the behaviour of the QIT in that condition and overcome the main challenges we might find when setting up ZAP together with Playwright.
Below you can find the flows performed by the QIT when running Playwright tests both without the changes from this PR and with it.
Without the changes from this PR:
With the changes from this PR:
By setting ZAP as a proxy in Playwright, we will be able to run Playwright tests as usual, but now ZAP will perform security checks on all pages captured during the Playwright tests (no matter if they are E2E or API), generating a report at the end of the execution.
This new feature is controlled by a new environment variable
QIT_SECURITY_CHECKS_PROXY
in a way that - when enabled - it will start a container with ZAP running in daemon mode, configure Playwright to use it as a proxy, generate the security reports and turn down the new ZAP container together with the rest of the environment at the end of the flow.Changes introduced in this PR
QIT_SECURITY_CHECKS_PROXY
is enabled.QIT_SECURITY_CHECKS_PROXY
is enabled) together with the rest of the environment.QIT_SECURITY_CHECKS_PROXY
is enabled.Testing instructions
php src/qit-cli.php backend:add
, then chooseLocal
.QIT_SECURITY_CHECKS_PROXY=1 php src/qit-cli.php run:activation automatewoo
.zap-report.html
andzap-report.json
.