Find script tags in an openapi spec #2289
-
Hello. I am new to Spectral. I am trying to write a custom rule to ensure that there are no script tags in an open api spec. But I can't seem to get it to work. I have tried with both the truthy and the pattern functions, but with no luck. These are rules that I have tried in my custom2.yaml file: Truthy: Pattern: The OpenAPI spec file (.yaml) that I am validating looks something like this. The custom rule is not finding the <script> tag in in the info.title field. In the end what I am after is a rule that will catch script tags anywhere in the spec file. Can someone please help me with this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have found that Spectral actually has a default rule for this in their built in "OAS" ruleset. The rule is called "no-script-tags-in-markdown". The rule can be inherited by adding this line to the ruleset file: #extends: [[spectral:oas, all]] https://meta.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules |
Beta Was this translation helpful? Give feedback.
I have found that Spectral actually has a default rule for this in their built in "OAS" ruleset. The rule is called "no-script-tags-in-markdown". The rule can be inherited by adding this line to the ruleset file: #extends: [[spectral:oas, all]]
https://meta.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules