All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.secrets.configuration.specifications.specification-json-schema.json Maven / Gradle / Ivy

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "AbstractMetadata": {
      "type": "object",
      "properties": {
        "impact": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "references": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Reference"
          }
        }
      },
      "required": [
        "name"
      ]
    },
    "AuxiliaryPattern": {
      "type": "object",
      "patternProperties": {
        "^pattern(After|Around|Before)$": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "pattern": {
                  "type": "string"
                },
                "maxCharDistance": {
                  "type": "integer"
                },
                "maxLineDistance": {
                  "type": "integer"
                }
              },
              "additionalProperties": false,
              "required": [
                "pattern"
              ]
            },
            {
              "type": "string"
            }
          ]
        }
      },
      "additionalProperties": false,
      "maxProperties": 1,
      "minProperties": 1
    },
    "BooleanCombination": {
      "type": "object",
      "patternProperties": {
        "^match(Each|Either)$": {
          "$ref": "#/$defs/ListOfMatches"
        },
        "^matchNot$": {
          "$ref": "#/$defs/UnaryMatcher"
        }
      },
      "additionalProperties": false,
      "maxProperties": 1,
      "minProperties": 1
    },
    "Detection": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "matching": {
          "$ref": "#/$defs/Matching"
        },
        "post": {
          "$ref": "#/$defs/PostModule"
        },
        "pre": {
          "$ref": "#/$defs/PreModule"
        }
      }
    },
    "FileFilter": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "content": {
          "$ref": "#/$defs/StringList"
        },
        "ext": {
          "$ref": "#/$defs/StringList"
        },
        "paths": {
          "$ref": "#/$defs/StringList"
        }
      }
    },
    "ListOfMatches": {
      "type": "array",
      "minItems": 2,
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/AuxiliaryPattern"
          },
          {
            "$ref": "#/$defs/BooleanCombination"
          }
        ]
      }
    },
    "UnaryMatcher": {
      "oneOf": [
        {
          "$ref": "#/$defs/AuxiliaryPattern"
        },
        {
          "$ref": "#/$defs/BooleanCombination"
        }
      ]
    },
    "Matching": {
      "type": "object",
      "properties": {
        "pattern": {
          "type": "string"
        },
        "context": {
          "$ref": "#/$defs/MatchingContext"
        }
      },
      "additionalProperties": false,
      "required": [
        "pattern"
      ]
    },
    "MatchingContext":{
      "oneOf": [
        {
          "$ref": "#/$defs/AuxiliaryPattern"
        },
        {
          "$ref": "#/$defs/BooleanCombination"
        }
      ]
    },
    "PostModule": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "heuristicFilter": {
          "additionalProperties": false,
          "type": "object",
          "properties": {
            "heuristics": {
              "$ref": "#/$defs/StringList"
            },
            "inputString": {
              "type": "string"
            }
          },
          "required": [
            "heuristics"
          ]
        },
        "patternNot": {
          "$ref": "#/$defs/StringList"
        },
        "statisticalFilter": {
          "additionalProperties": false,
          "type": "object",
          "properties": {
            "inputString": {
              "type": "string"
            },
            "threshold": {
              "type": "number"
            }
          },
          "required": [
            "threshold"
          ]
        }
      }
    },
    "PreModule": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "include": {
          "$ref": "#/$defs/FileFilter"
        },
        "reject": {
          "$ref": "#/$defs/FileFilter"
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "main",
              "test"
            ]
          }
        }
      }
    },
    "Reference": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "link": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "Standards",
            "Conference Presentations",
            "Articles & blog posts",
            "Documentation"
          ]
        }
      },
      "required": [
        "description",
        "link",
        "type"
      ]
    },
    "RuleExample": {
      "additionalProperties": false,
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "containsSecret": {
            "type": "boolean"
          },
          "match": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "containsSecret"
        ]
      }
    },
    "StringList": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "type": "object",
  "properties": {
    "provider": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "rules": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "examples": {
                "$ref": "#/$defs/RuleExample"
              },
              "id": {
                "type": "string"
              },
              "rspecKey": {
                "type": "string"
              },
              "metadata": {
                "allOf": [
                  {
                    "$ref": "#/$defs/AbstractMetadata"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "charset": {
                        "type": "string"
                      },
                      "defaultProfile": {
                        "type": "boolean"
                      }
                    }
                  }
                ]
              },
              "detection": {
                "$ref": "#/$defs/Detection",
                "required": [
                  "matching"
                ]
              }
            },
            "required": [
              "examples",
              "id",
              "rspecKey",
              "metadata",
              "detection"
            ]
          }
        },
        "metadata": {
          "allOf": [
            {
              "$ref": "#/$defs/AbstractMetadata"
            },
            {
              "type": "object",
              "properties": {
                "category": {
                  "$ref": "categories.json#/$defs/AllowedCategory"
                },
                "fix": {
                  "type": "string"
                }
              },
              "required": [
                "category"
              ]
            }
          ]
        },
        "detection": {
          "$ref": "#/$defs/Detection"
        }
      },
      "required": [
        "rules",
        "metadata"
      ]
    }
  },
  "required": [
    "provider"
  ],
  "additionalProperties": false
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy