testable-eu / sast-tp-framework

TP-Framework: Testability Pattern Framework for SAST
https://owasp.org/www-project-testability-patterns-for-web-applications/
Apache License 2.0
11 stars 3 forks source link

repair pattern #69

Closed felix-20 closed 1 year ago

felix-20 commented 1 year ago

This PR should introduce a new feature for the framework, that can help you reviewing your patterns in your library. Simple usage example:

tpframework patternrepair -l php -p 1 --skip-readme

This command will take a look at PHP pattern 1 and tries to repair it, --skip-readme tells the tool to skip generating a new README file for that pattern. Repair a pattern means:

At the moment this feature is only supported for PHP patterns, the feature was developed as part of reviewing all PHP patterns. This PR aims to change the role of the Pattern and Instance class in the framework a little bit. It enables the possibility, to consider the pattern and the instance without handling the filesystem paths. i.e. the Instance object saves all the paths from the instance JSON as relative paths to a base path. This should make it possible to simplify some of the file system operations.

I would suggest merging this PR after the CPG only feature, as I expect a few merge conflicts