sarif.info reference

Specification · §3.27

result object

A single finding: one problem, at one location, attributable to one rule.

You may have arrived here from an RDF or JSON-LD document. http://sarif.info/Result is the term URI that schema.org uses for the SARIF result object: schema.org's JSON-LD context declares the prefix sarif: http://sarif.info/, and its Error class is defined as rdfs:subClassOf sarif:Result. A machine-readable description of this term is available at /Result.jsonld, and is served from this URL directly under content negotiation for application/ld+json.

A result is a single finding produced by an analysis tool: one problem, at one place, attributable to one rule. It is the payload of the whole format. A run carries an array of them, and everything else in a SARIF file — the tool description, the rule metadata, the artifact inventory — exists to give results somewhere to point.

The normative definition is §3.27 of the OASIS specification.

The minimum

Exactly one property is required: message. A result with nothing but a message is valid SARIF.

{ "message": { "text": "Something is wrong here." } }

That is rarely useful, so in practice a result carries at least a rule identifier, a severity and a location:

{
  "ruleId": "CA2100",
  "ruleIndex": 3,
  "kind": "fail",
  "level": "error",
  "message": {
    "text": "The query string is built by concatenating user input."
  },
  "locations": [
    {
      "physicalLocation": {
        "artifactLocation": { "uri": "src/db/Query.cs" },
        "region": { "startLine": 118, "startColumn": 21, "endColumn": 64 }
      }
    }
  ],
  "partialFingerprints": {
    "primaryLocationLineHash": "39fa2ee980eb94b0:1"
  },
  "baselineState": "new"
}

kind and level

These two properties are often confused. kind says what happened when the rule was evaluated; level says how bad it is.

kind — evaluation state (§3.27.9)

"fail" means the rule was evaluated and a problem was found; "pass" means it was evaluated and none was. "open" is for proof-based tools that could neither prove nor disprove a violation, "notApplicable" means the rule did not apply to the target at all, and "review" asks a human to decide. If kind is absent it defaults to "fail".

level — severity (§3.27.10)

Severity only has meaning for a failure. The specification requires that when kind is anything other than "fail", level is either absent or "none" — a passing result cannot be an error.

Identity across runs

Three properties answer “is this the same finding I saw yesterday?”, and they are not interchangeable. guid identifies this result in this run. correlationGuid identifies the equivalence class of logically identical results across runs. fingerprints and partialFingerprints let the tool contribute strings that survive the code moving around — a partial fingerprint is expected to change when the surrounding code changes, a full fingerprint is not. baselineState (new, unchanged, updated, absent) then records how the result compares to a baseline run.

All properties

Every property the specification defines on a result object, in the order a reader tends to need them. Types are the schema's own; section numbers refer to the OASIS text.

PropertyTypeDescription
messagerequiredmessageA message that describes the result. §3.27.11
ruleIdstringThe stable, unique identifier of the rule, if any, to which this result is relevant. §3.27.5
ruleIndexintegerThe index within the tool component rules array of the rule object associated with this result. §3.27.6
rulereportingDescriptorReferenceA reference used to locate the rule descriptor relevant to this result. §3.27.7
kindstringA value that categorizes results by evaluation state. §3.27.9
levelstringA value specifying the severity level of the result. §3.27.10
locationslocation[]The set of locations where the result was detected. §3.27.12
analysisTargetartifactLocationIdentifies the artifact that the analysis tool was instructed to scan. §3.27.13
guidstringA stable, unique identifier for the result in the form of a GUID. §3.27.3
correlationGuidstringA stable, unique identifier for the equivalence class of logically identical results to which this result belongs, in the form of a GUID. §3.27.4
fingerprintsobjectA set of strings each of which individually defines a stable, unique identity for the result. §3.27.16
partialFingerprintsobjectA set of strings that contribute to the stable, unique identity of the result. §3.27.17
relatedLocationslocation[]A set of locations relevant to this result. §3.27.22
codeFlowscodeFlow[]An array of 'codeFlow' objects relevant to the result. §3.27.18
graphsgraph[]An array of zero or more unique graph objects associated with the result. §3.27.19
graphTraversalsgraphTraversal[]An array of one or more unique 'graphTraversal' objects. §3.27.20
stacksstack[]An array of 'stack' objects relevant to the result. §3.27.21
webRequestwebRequestA web request associated with this result. §3.27.14
webResponsewebResponseA web response associated with this result. §3.27.15
taxareportingDescriptorReference[]An array of references to taxonomy reporting descriptors that are applicable to the result. §3.27.8
suppressionssuppression[]A set of suppressions relevant to this result. §3.27.23
baselineStatestringThe state of a result relative to a baseline of a previous run. §3.27.24
ranknumberA number representing the priority or importance of the result. §3.27.25
occurrenceCountintegerA positive integer specifying the number of times this logically unique result was observed in this run. §3.27.31
provenanceresultProvenanceInformation about how and when the result was detected. §3.27.29
fixesfix[]An array of 'fix' objects, each of which represents a proposed fix to the problem indicated by the result. §3.27.30
attachmentsattachment[]A set of artifacts relevant to the result. §3.27.26
workItemUrisstring[]The URIs of the work items associated with this result. §3.27.27
hostedViewerUristringAn absolute URI at which the result can be viewed. §3.27.28
propertiespropertyBagKey/value pairs that provide additional information about the result. §3.8

The schema.org relationship

schema.org's Error type is declared as a subclass of this term. In the published schema.org vocabulary:

{
  "@id": "schema:Error",
  "@type": "rdfs:Class",
  "rdfs:label": "Error",
  "rdfs:comment": "Representation of an Error.",
  "rdfs:subClassOf": [
    { "@id": "sarif:Result" },
    { "@id": "schema:InstantaneousEvent" }
  ]
}

with "sarif": "http://sarif.info/" declared in the vocabulary's context. That is why RDF prefix resolvers, ontology registries and generated API documentation link to this URL. The description served here is maintained independently and is not a normative OASIS artifact; it exists so that the term dereferences to something meaningful rather than to a parked domain.