Pattern type for structured data files (yaml, json...)
See original GitHub issueIs your feature request related to a problem? Please describe. In order to be able to detect feature usage in structured configuration files (yaml, json, xml…) it would be very useful to be able to search for occurrences of certain entries regardless of the order of declaration in the file.
An example would be:
If we have a config.yaml file and we have the following configuration:
app:
myfeature:
prop1: x
prop2: x
propN: x
enabled: true
If I want to detect with a rule if the ‘myfeature’ functionality is enabled I would not have a reliable solution at the moment. Detecting if app.my-feature.enabled = true with patterns, modiffiers or conditions does not cover all cases, e.g. if the declaration order is changed or the configuration is put in one line. I.e. a pattern such as:
“pattern”: “app:\s+myfeature:\s+enabled: *true”.
It would not cover the above example since the order of the enabled property can be changed as it is a structured data type.
Describe the solution you’d like Ability to be able to perform patterns on structured data types.
Describe alternatives you’ve considered
- Implement new pattern types to support operations on structured data types (yaml, json…).
- Provide an extension mechanism to be able to do file processing with parsing tools.
Issue Analytics
- State:
- Created 2 years ago
- Comments:33 (23 by maintainers)
Top GitHub Comments
In all the rules we use I have always considered pom.xml as the language as indicated in the doc and it has always worked fine:
https://github.com/microsoft/ApplicationInspector/wiki/3.4-Applies_to-(languages)#language-support
I opened a new issue (#497) to cover adding support for xml docs with namespace specified and will continue tracking this issue there.