|
| 1 | +--- |
| 2 | +sidebar_position: 9 |
| 3 | +title: Security mutation testing |
| 4 | +--- |
| 5 | + |
| 6 | +# Security mutation testing |
| 7 | + |
| 8 | +PIT mutates a curated set of security-boundary classes and runs their focused unit tests. The |
| 9 | +advisory result measures whether those tests reject injected changes; it is not a security guarantee |
| 10 | +or a mutation-score gate. |
| 11 | + |
| 12 | +## Run the suite |
| 13 | + |
| 14 | +The **Security mutation testing** workflow runs when a pull request changes an affected security |
| 15 | +area or the suite's build inputs. It also supports manual dispatch. Run the same analysis locally |
| 16 | +with JDK 21: |
| 17 | + |
| 18 | +```bash |
| 19 | +pnpm run test:server:mutation |
| 20 | +``` |
| 21 | + |
| 22 | +The command prepares reactor dependencies, compiles the target tests, and runs PIT. It fails if any |
| 23 | +Maven phase fails, the report is missing or invalid, or PIT leaves a mutation in a technical or |
| 24 | +incomplete state. The job summary reports timing and outcomes. PIT's HTML/XML reports and a Markdown |
| 25 | +summary are written below the application module's `target/pit-reports` directory and uploaded by |
| 26 | +the workflow even on failure. |
| 27 | + |
| 28 | +The command evaluates the full target set without incremental analysis and is limited to eight |
| 29 | +minutes, leaving two minutes for artifact upload. |
| 30 | + |
| 31 | +## Triage |
| 32 | + |
| 33 | +The pull-request author reviews reported survivors and uncovered mutations in affected code. The |
| 34 | +affected server CODEOWNERS review any accepted classification. |
| 35 | + |
| 36 | +- Add a public-behavior test when a mutant exposes an unverified contract. |
| 37 | +- Explain an accepted equivalent or unproductive mutant in the pull-request description instead of |
| 38 | + asserting private call order or implementation details. |
| 39 | +- Remove unwired code instead of building mutation tests around it. |
| 40 | +- Treat technical and incomplete statuses as an invalid run, never as killed mutations. |
| 41 | + |
| 42 | +[Issue #1498](https://github.com/ls1intum/Hephaestus/issues/1498) records the suite's evaluation and |
| 43 | +the decision to keep it non-required and advisory. |
| 44 | + |
| 45 | +## Further reading |
| 46 | + |
| 47 | +- [PIT Maven guide](https://pitest.org/quickstart/maven/) |
| 48 | +- [Mutation testing at Google](https://testing.googleblog.com/2021/04/mutation-testing.html) |
0 commit comments