{
  "type": "object",
  "additionalProperties": true,
  "required": [
    "platform",
    "profiles",
    "statistics",
    "version"
  ],
  "properties": {
    "platform": {
      "$ref": "#/definitions/Platform",
      "description": "Information on the platform the run from the tool that generated the findings was from.  Example: the name of the operating system."
    },
    "profiles": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Exec_JSON_Profile"
      },
      "description": "Information on the run(s) from the tool that generated the findings.  Example: the findings."
    },
    "statistics": {
      "$ref": "#/definitions/Statistics",
      "description": "Statistics for the run(s) from the tool that generated the findings.  Example: the runtime duration."
    },
    "version": {
      "type": "string",
      "description": "Version number of the tool that generated the findings.  Example: '4.18.108' is a version of Chef InSpec."
    }
  },
  "description": "The top level value containing all of the results.",
  "title": "Exec JSON Output",
  "definitions": {
    "Control_Description": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "label",
        "data"
      ],
      "properties": {
        "label": {
          "type": "string",
          "description": "The type of description.  Examples: 'fix' or 'check'."
        },
        "data": {
          "type": "string",
          "description": "The text of the description."
        }
      },
      "description": "A description for a control.",
      "title": "Control Description"
    },
    "Control_Group": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "id",
        "controls"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier for the group.  Example: the relative path to the file specifying the controls."
        },
        "title": {
          "type": [
            "null",
            "string"
          ],
          "description": "The title of the group - should be human readable."
        },
        "controls": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The set of controls as specified by their ids in this group.  Example: 'V-75443'."
        }
      },
      "description": "Descriptions for controls in a group, such as the list of all the controls.",
      "title": "Control Group"
    },
    "Control_Result": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "code_desc",
        "start_time"
      ],
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/definitions/Control_Result_Status",
              "description": "The status of this test within the control.  Example: 'failed'."
            },
            {
              "type": "null"
            }
          ]
        },
        "code_desc": {
          "type": "string",
          "description": "A description of this test.  Example: 'limits.conf * is expected to include ['hard', 'maxlogins', '10']."
        },
        "run_time": {
          "type": [
            "number",
            "null"
          ],
          "description": "The execution time in seconds for the test."
        },
        "start_time": {
          "type": "string",
          "description": "The time at which the test started."
        },
        "resource": {
          "type": [
            "string",
            "null"
          ],
          "description": "The resource used in the test.  Example: in Inspec, you can use the 'File' resource."
        },
        "message": {
          "type": [
            "string",
            "null"
          ],
          "description": "An explanation of the test status - usually only provided when the test fails."
        },
        "skip_message": {
          "type": [
            "string",
            "null"
          ],
          "description": "An explanation of the test status if the status was 'skipped."
        },
        "exception": {
          "type": [
            "string",
            "null"
          ],
          "description": "The type of exception if an exception was thrown."
        },
        "resource_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The unique identifier of the resource."
        },
        "backtrace": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "The stacktrace/backtrace of the exception if one occurred."
        }
      },
      "description": "A test within a control and its results and findings such as how long it took to run.",
      "title": "Control Result"
    },
    "Control_Result_Status": {
      "type": "string",
      "enum": [
        "passed",
        "failed",
        "skipped",
        "error"
      ],
      "description": "The status of a control.  Should be one of 'passed', 'failed', 'skipped', or 'error'.",
      "title": "Control Result Status"
    },
    "Dependency": {
      "type": "object",
      "additionalProperties": true,
      "required": [],
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The name/assigned alias."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "The address of the dependency."
        },
        "branch": {
          "type": [
            "string",
            "null"
          ],
          "description": "The branch name for a git repo."
        },
        "path": {
          "type": [
            "string",
            "null"
          ],
          "description": "The relative path if the dependency is locally available."
        },
        "status_message": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reason for the status if it is 'failed' or 'skipped'."
        },
        "status": {
          "type": [
            "string",
            "null"
          ],
          "description": "The status.  Should be: 'loaded', 'failed', or 'skipped'."
        },
        "git": {
          "type": [
            "string",
            "null"
          ],
          "description": "The location of the git repo.  Example: 'https://github.com/mitre/canonical-ubuntu-18.04-lts-stig-baseline.git'."
        },
        "supermarket": {
          "type": [
            "string",
            "null"
          ],
          "description": "The 'user/profilename' attribute for a Supermarket server."
        },
        "compliance": {
          "type": [
            "string",
            "null"
          ],
          "description": "The 'user/profilename' attribute for an Automate server."
        }
      },
      "description": "A dependency for a profile.  Can include relative paths or urls for where to find the dependency.",
      "title": "Dependency"
    },
    "Exec_JSON_Control": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "id",
        "impact",
        "refs",
        "tags",
        "source_location",
        "results"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The id."
        },
        "title": {
          "type": [
            "null",
            "string"
          ],
          "description": "The title - is nullable."
        },
        "desc": {
          "type": [
            "null",
            "string"
          ],
          "description": "The description for the overarching control."
        },
        "descriptions": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Control_Description"
          },
          "description": "A set of additional descriptions.  Example: the 'fix' text."
        },
        "impact": {
          "type": "number",
          "minimum": 0.0,
          "maximum": 1.0,
          "description": "The impactfulness or severity."
        },
        "refs": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Reference"
          },
          "description": "The set of references to external documents."
        },
        "tags": {
          "type": "object",
          "additionalProperties": true,
          "description": "A set of tags - usually metadata."
        },
        "code": {
          "type": [
            "string",
            "null"
          ],
          "description": "The raw source code of the control. Note that if this is an overlay control, it does not include the underlying source code."
        },
        "source_location": {
          "$ref": "#/definitions/Source_Location",
          "description": "The explicit location of the control within the source code."
        },
        "results": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Control_Result"
          },
          "description": "\n             The set of all tests within the control and their results and findings.  Example:\n             For Chef Inspec, if in the control's code we had the following:\n               describe sshd_config do\n                 its('Port') { should cmp 22 }\n               end\n             The findings from this block would be appended to the results, as well as those of any other blocks within the control.\n          "
        },
        "waiver_data": {
          "anyOf": [
            {
              "$ref": "#/definitions/Waiver_Data"
            },
            {
              "type": "null"
            }
          ]
        },
        "attestation_data": {
          "anyOf": [
            {
              "$ref": "#/definitions/Attestation_Data"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Describes a control and any findings it has.",
      "title": "Exec JSON Control"
    },
    "Exec_JSON_Profile": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "name",
        "sha256",
        "supports",
        "attributes",
        "groups",
        "controls"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name - must be unique."
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "The title - should be human readable."
        },
        "maintainer": {
          "type": [
            "string",
            "null"
          ],
          "description": "The maintainer(s)."
        },
        "copyright": {
          "type": [
            "string",
            "null"
          ],
          "description": "The copyright holder(s)."
        },
        "copyright_email": {
          "type": [
            "string",
            "null"
          ],
          "description": "The email address or other contact information of the copyright holder(s)."
        },
        "depends": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Dependency"
          },
          "description": "The set of dependencies this profile depends on.  Example: an overlay profile is dependent on another profile."
        },
        "parent_profile": {
          "type": [
            "string",
            "null"
          ],
          "description": "The name of the parent profile if the profile is a dependency of another."
        },
        "license": {
          "type": [
            "string",
            "null"
          ],
          "description": "The copyright license.  Example: the full text or the name, such as 'Apache License, Version 2.0'."
        },
        "summary": {
          "type": [
            "string",
            "null"
          ],
          "description": "The summary.  Example: the Security Technical Implementation Guide (STIG) header."
        },
        "version": {
          "type": [
            "string",
            "null"
          ],
          "description": "The version of the profile."
        },
        "supports": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Supported_Platform"
          },
          "description": "The set of supported platform targets."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "The description - should be more detailed than the summary."
        },
        "inspec_version": {
          "type": [
            "string",
            "null"
          ],
          "description": "The version of Inspec."
        },
        "sha256": {
          "type": "string",
          "description": "The checksum of the profile."
        },
        "status": {
          "type": [
            "string",
            "null"
          ],
          "description": "The status.  Example: loaded."
        },
        "status_message": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reason for the status.  Example: why it was skipped or failed to load."
        },
        "skip_message": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reason for skipping if it was skipped."
        },
        "controls": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Exec_JSON_Control"
          },
          "description": "The set of controls including any findings."
        },
        "groups": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Control_Group"
          },
          "description": "A set of descriptions for the control groups.  Example: the ids of the controls."
        },
        "attributes": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "description": "An input or attribute used in the run."
          },
          "description": "The input(s) or attribute(s) used in the run."
        }
      },
      "description": "Information on the set of controls assessed.  Example: it can include the name of the Inspec profile and any findings.",
      "title": "Exec JSON Profile"
    },
    "Platform": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "name",
        "release"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the platform this was run on."
        },
        "release": {
          "type": "string",
          "description": "The version of the platform this was run on."
        },
        "target_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The id of the target.  Example: the name and version of the operating system were not sufficient to identify the platform so a release identifier can additionally be provided like '21H2' for the release version of MS Windows 10."
        }
      },
      "description": "Platform information such as its name.",
      "title": "Platform"
    },
    "Reference": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "ref"
          ],
          "properties": {
            "ref": {
              "type": "string"
            }
          },
          "description": "A human readable/meaningful reference.  Example: a book title."
        },
        {
          "type": "object",
          "required": [
            "url"
          ],
          "properties": {
            "url": {
              "type": "string"
            }
          },
          "description": "A url pointing at the reference."
        },
        {
          "type": "object",
          "required": [
            "uri"
          ],
          "properties": {
            "uri": {
              "type": "string"
            }
          },
          "description": "A uri pointing at the reference."
        },
        {
          "type": "object",
          "required": [
            "ref"
          ],
          "properties": {
            "ref": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": true
              }
            }
          },
          "description": ""
        }
      ],
      "description": "A reference to an external document.",
      "title": "Reference"
    },
    "Source_Location": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "ref": {
          "type": [
            "string",
            "null"
          ],
          "description": "Path to the file that this control originates from."
        },
        "line": {
          "type": [
            "number",
            "null"
          ],
          "description": "The line on which this control is located."
        }
      },
      "required": [],
      "description": "The explicit location of the control.",
      "title": "Source Location"
    },
    "Statistic_Block": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "total"
      ],
      "properties": {
        "total": {
          "type": "number",
          "description": "The total.  Example: the total number of controls in a given category for a run."
        }
      },
      "description": "Statistics for a given item, such as the total.",
      "title": "Statistic Block"
    },
    "Statistic_Hash": {
      "type": "object",
      "additionalProperties": true,
      "required": [],
      "properties": {
        "passed": {
          "anyOf": [
            {
              "$ref": "#/definitions/Statistic_Block",
              "description": "Statistics for the controls that passed."
            },
            {
              "type": "null"
            }
          ]
        },
        "skipped": {
          "anyOf": [
            {
              "$ref": "#/definitions/Statistic_Block",
              "description": "Statistics for the controls that were skipped."
            },
            {
              "type": "null"
            }
          ]
        },
        "failed": {
          "anyOf": [
            {
              "$ref": "#/definitions/Statistic_Block",
              "description": "Statistics for the controls that failed."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Statistics for the control results.",
      "title": "Statistic Hash"
    },
    "Statistics": {
      "type": "object",
      "additionalProperties": true,
      "required": [],
      "properties": {
        "duration": {
          "type": [
            "number",
            "null"
          ],
          "description": "How long (in seconds) this run by the tool was."
        },
        "controls": {
          "anyOf": [
            {
              "$ref": "#/definitions/Statistic_Hash",
              "description": "Breakdowns of control statistics by result"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Statistics for the run(s) such as how long it took.",
      "title": "Statistics"
    },
    "Supported_Platform": {
      "type": "object",
      "additionalProperties": true,
      "required": [],
      "properties": {
        "platform-family": {
          "type": [
            "string",
            "null"
          ],
          "description": "The platform family.  Example: 'redhat'."
        },
        "platform-name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The platform name - can include wildcards.  Example: 'debian'."
        },
        "platform": {
          "type": [
            "string",
            "null"
          ],
          "description": "The location of the platform.  Can be: 'os', 'aws', 'azure', or 'gcp'."
        },
        "release": {
          "type": [
            "string",
            "null"
          ],
          "description": "The release of the platform.  Example: '20.04' for 'ubuntu'."
        },
        "os-family": {
          "type": [
            "string",
            "null"
          ],
          "description": "Deprecated in favor of platform-family."
        },
        "os-name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Deprecated in favor of platform-name."
        }
      },
      "description": "A supported platform target.  Example: the platform name being 'ubuntu'.",
      "title": "Supported Platform"
    },
    "Waiver_Data": {
      "type": "object",
      "additionalProperties": true,
      "required": [],
      "properties": {
        "expiration_date": {
          "type": [
            "string",
            "null"
          ]
        },
        "justification": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "run": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "skipped_due_to_waiver": {
          "type": [
            "boolean",
            "null",
            "string"
          ]
        }
      }
    },
    "Attestation_Status": {
      "type": "string",
      "enum": [
        "passed",
        "failed"
      ],
      "description": "The attested status of the control",
      "title": "Control Attestation Status"
    },
    "Attestation_Data": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "control_id",
        "explanation",
        "frequency",
        "status",
        "updated",
        "updated_by"
      ],
      "properties": {
        "control_id": {
          "type": "string"
        },
        "explanation": {
          "type": "string"
        },
        "frequency": {
          "type": "string"
        },
        "status": {
          "$ref": "#/definitions/Attestation_Status"
        },
        "updated": {
          "type": "string"
        },
        "updated_by": {
          "type": "string"
        }
      }
    }
  }
}
