Evidence OneModel GraphQL

The JFrog Evidence service provides a GraphQL API for querying evidence attached to artifacts and other subject types. This API follows the OneModel GraphQL conventions and supports pagination, filtering, ordering, and federated queries.

Key features include:

  • Evidence management: Query, search, and retrieve evidence associated with artifacts and other subject types
  • Entity-type search: Filter evidence by entityType and entityId for application versions, package versions, builds, and more
  • Federation support: Resolve evidence from other OneModel subgraphs (for example, AppTrust application versions)

For Release Bundle version queries (including evidence attached at bundle, artifact, or build scope), see Release Lifecycle Management GraphQL.

For field-level schema details and the complete list of operations, use the GraphQL Playground in the JFrog Platform UI under Integrations > GraphQL Playground. For more information, see Explore Schema With GraphQL Playground.

Prerequisites

  • Requires Artifactory 7.104.2 or later
  • Subscription information:
    • The ability to collect internal evidence generated by Artifactory requires a Pro license or above. Internal evidence generated by Xray requires a Pro X license or above.
    • The ability for users to create evidence and upload it to Artifactory requires an Enterprise+ license.
  • Define the scoped token audience as *@*. This definition is required to run cross-service queries.

Subgraph Summary

This subgraph exposes the Evidence query domain. It uses Relay-style connections for forward pagination and supports filtering, ordering, and federated usage with other services.

Query Entry Points

  • Query.evidence -> EvidenceQueries: root for direct evidence retrieval and evidence search
    • getEvidenceById(id): fetch one evidence record by ID
    • getEvidence(repositoryKey: String!, path: String!, name: String!, sha256: Sha256): fetch one evidence record by repository location
    • searchEvidence(where: EvidenceWhereInput, first: Int, after: Cursor): search evidence within one subject scope. At runtime, where must include hasSubjectWith; omitting either returns a bad request.

The ! in these signatures marks a required GraphQL argument. Arguments without ! are optional in the schema.

Main Entities

Evidence Domain

  • Evidence: core record describing attestations attached to a subject; includes metadata (evidenceId, name, sha256, downloadPath, predicateCategory, predicateType, predicateSlug, predicate, createdAt, createdBy, verified, systemEvidence, providerId, stageName) and links to related entities
  • EvidenceSubject: logical identity of the entity evidence is attached to (repositoryKey, projectKey, applicationKey, path, name, sha256, fullPath, entityType, entityId)
  • EvidenceAttachment: file attached to an evidence record (for example, legal documents), with name, sha256, optional type, and downloadPath
  • EvidenceSigningKey: key metadata used to verify signatures for an evidence record (alias, publicKey)
  • EvidenceConnection/EvidenceEdge: paginated wrapper used when returning lists of evidence

Shared Conventions

  • PageInfo and Cursor: standard Relay cursor pagination primitives
  • Common scalars used across entities include Date, Sha256, and JSON

Entity Relationships

  • Evidence -> EvidenceSubject (many-to-one): each evidence record references a subject identity
  • Evidence -> EvidenceSigningKey (optional one-to-one): an evidence record may include the signing key used for verification
  • Evidence -> EvidenceAttachment (one-to-many): an evidence record may include attached files
  • EvidenceSubject -> EvidenceConnection (one-to-many): a subject can have multiple evidence records, with optional filtering and ordering

These relationships are described in the diagram below.

flowchart TD
    subgraph QueryDomain["Query entry points"]
        Query[Query]
        EvidenceQueries[EvidenceQueries]
    end

    subgraph EvidenceDomain["Evidence domain"]
        Evidence["Evidence<br/>(includes verified, systemEvidence)"]
        EvidenceSubject["EvidenceSubject<br/>(federated entity)"]
        EvidenceSigningKey[EvidenceSigningKey]
        EvidenceAttachment[EvidenceAttachment]
        EvidenceConnection["EvidenceConnection<br/>(totalCount, edges, pageInfo)"]
        EvidenceEdge[EvidenceEdge]
        EvidenceWhere["EvidenceWhereInput"]
        SubjectWhere["EvidenceSubjectWhereInput<br/>(hasSubjectWith required)"]
    end

    PageInfo["PageInfo<br/>(first / after)"]
    OtherSubgraphs["Other subgraphs<br/>(e.g. AppTrust)"]
    RlmSubgraph["Release Lifecycle Management<br/>(separate subgraph)"]

    Query -->|evidence| EvidenceQueries

    EvidenceQueries -->|"getEvidenceById(id)"| Evidence
    EvidenceQueries -->|"getEvidence(repositoryKey: String!, path: String!, name: String!, sha256: Sha256)"| Evidence
    EvidenceQueries -->|"searchEvidence(where: EvidenceWhereInput, first: Int, after: Cursor)"| EvidenceConnection
    EvidenceQueries -.->|where| EvidenceWhere
    EvidenceWhere -->|hasSubjectWith| SubjectWhere
    SubjectWhere -.->|scopes| EvidenceSubject

    EvidenceConnection -->|edges| EvidenceEdge
    EvidenceEdge -->|node| Evidence
    EvidenceConnection -->|pageInfo| PageInfo

    Evidence -->|subject| EvidenceSubject
    Evidence -->|signingKey| EvidenceSigningKey
    Evidence -->|attachments| EvidenceAttachment

    EvidenceSubject -->|"evidenceConnection(where: EvidenceSubjectToEvidenceWhereInput, orderBy: EvidenceOrderInput, first: Int, after: Cursor)"| EvidenceConnection
    OtherSubgraphs -.->|"federation keys:<br/>fullPath<br/>or repositoryKey/projectKey/applicationKey<br/>+ entityType + entityId"| EvidenceSubject
    RlmSubgraph -.->|"bundle / artifact / build<br/>evidenceConnection"| EvidenceConnection

Search Scope and Subject Filters

searchEvidence searches within one subject scope. Pass where: EvidenceWhereInput with required hasSubjectWith: EvidenceSubjectWhereInput!. Omitting where or hasSubjectWith returns a bad request.

EvidenceSubjectWhereInput supports these scope patterns:

  • Without entityType: repositoryKey is required. Optional path, name, and sha256 narrow the match. repositoryKey alone matches every subject in that repository.
  • With entityType, set entityId for one subject, or omit it to match every subject of that type in the scope.
  • Reserved type scope keys:
    • artifact and package-version: require repositoryKey
    • application-version, release-bundle-version, and build-version: take projectKey (omit it for the default project)
    • Other entity types: take repositoryKey, projectKey, or applicationKey

entityId Formats

Format depends on entityType:

entityTypeentityId formatExample
Non-artifact types (for example, gitCommit)Typically a single segment; allowed characters [-_.A-Za-z0-9]abc123def
artifactRepo-relative path including file name. Repository key is not part of the ID; pass repositoryKey separately.com/acme/service/1.2.3/service-1.2.3.jar
package-version{name}/versions/{version}; requires repositoryKeyorg.apache.tomcat:catalina/versions/9.0.0
application-version{applicationKey}/{version}orders-app/2.4.0
release-bundle-version{bundleName}/{version}my-release/1.0.0
build-version{buildName}/{buildNumber} or {buildName}/{buildNumber}/{timestamp}my-build/42

Reserved Artifactory lead-artifact types are: artifact, package-version, application-version, release-bundle-version, and build-version.

Filtering and Ordering on a Subject

When resolving EvidenceSubject.evidenceConnection, you can filter with EvidenceSubjectToEvidenceWhereInput and order with EvidenceOrderInput.

Supported where filters:

  • predicateCategory, predicateType, predicateSlug
  • verified, createdBy, providerId, stageName
  • createdAfter, createdBefore (inclusive date range)

Supported orderBy.field values (EvidenceOrderField):

  • CREATED_AT, NAME, PREDICATE_CATEGORY, PREDICATE_TYPE, VERIFIED

Pagination

searchEvidence and EvidenceSubject.evidenceConnection use forward cursor pagination with first and after only.

  • Default first: 100 when omitted
  • Maximum first: 100. A value below 1 or above 100 is treated as 100.
  • after: exclusive cursor of the last item already returned. Omit to start at the first item. An invalid cursor returns an error. A cursor past the end of the result returns an empty page.
  • Connections return totalCount (full match count across all pages), edges.node, and pageInfo

Traversal Patterns

The patterns that follow describe how data is typically queried within this subgraph.

  • Direct lookup: use getEvidenceById to fetch a single record by ID, or getEvidence to fetch by repository location and optional SHA-256
  • Evidence-centric search: pass a required where.hasSubjectWith subject scope and page through searchEvidence with first and after
  • Subject-centric: resolve an EvidenceSubject (directly or via federation) and traverse evidenceConnection with where and orderBy filters
  • Cross-domain: query Release Bundle versions from the Release Lifecycle Management subgraph, then traverse that domain's evidenceConnection fields. For more information, see Release Lifecycle Management GraphQL.

Federation

EvidenceSubject is a federated entity. Other subgraphs can resolve evidence by referencing a subject using one of these key combinations:

  • fullPath
  • repositoryKey, entityType, entityId
  • projectKey, entityType, entityId
  • applicationKey, entityType, entityId

fullPath is the Artifactory locator of the subject artifact (not the evidence file), in the form <repositoryKey>/<path>/<name>, or <repositoryKey>/<name> when path is empty.

Notes

  • Evidence.systemEvidence indicates whether the evidence was created by a JFrog platform service
  • Evidence.repositoryKey is deprecated in favor of Evidence.subject.repositoryKey
  • Evidence.path is deprecated. To locate evidence for an artifact (for example, for deletion), concatenate subject.path + '/' + subject.name + '/' + evidence.name
  • Some fields are marked experimental (for example, Evidence.subject) and may change
  • EvidenceSubject.evidenceConnection returns a non-null EvidenceConnection!

Common Use Cases

Get Evidence by ID

query GetEvidenceById {
  evidence {
    getEvidenceById(id: "evidence-123") {
      evidenceId
      name
      predicateType
      predicateCategory
      verified
      createdBy
      createdAt
      subject {
        fullPath
        entityType
        entityId
      }
      attachments {
        name
        sha256
        type
        downloadPath
      }
    }
  }
}

Get Evidence by Repository Location

query GetEvidenceByLocation {
  evidence {
    getEvidence(
      repositoryKey: "my-repo-key"
      path: "artifacts/path"
      name: "evidence.json"
    ) {
      evidenceId
      predicateType
      verified
      downloadPath
    }
  }
}

Find All Evidence for an Artifact

This query finds all attestations (cryptographically signed metadata records) for a given artifact. where.hasSubjectWith is required.

query FindAllEvidenceForArtifact {
  evidence {
    searchEvidence(
      first: 20
      where: {
        hasSubjectWith: {
          repositoryKey: "docker-local"
          path: "my-app/latest"
          name: "manifest.json"
        }
      }
    ) {
      totalCount
      edges {
        node {
          evidenceId
          name
          predicateType
          verified
          createdBy
        }
      }
    }
  }
}

Search Evidence by Subject

The query shown below searches for evidence associated with a specific artifact as defined by its repository key, path, and name.

query SearchEvidenceBySubject {
  evidence {
    searchEvidence(
      where: {
        hasSubjectWith: {
          repositoryKey: "my-docker-repo"
          path: "images"
          name: "my-app"
        }
      }
      first: 20
    ) {
      totalCount
      pageInfo { hasNextPage endCursor }
      edges {
        node {
          evidenceId
          name
          predicateType
          createdAt
          verified
          predicate
        }
      }
    }
  }
}

Search Evidence by Entity Type

Search for evidence attached to an application version or other typed subject. For application-version, omit projectKey to use the default project, or set it to scope a specific project.

query SearchEvidenceByEntityType {
  evidence {
    searchEvidence(
      first: 20
      where: {
        hasSubjectWith: {
          entityType: "application-version"
          entityId: "orders-app/2.4.0"
        }
      }
    ) {
      totalCount
      edges {
        node {
          evidenceId
          predicateType
          predicateCategory
          verified
          stageName
        }
      }
    }
  }
}

Filter and Order Evidence on a Subject

When resolving an EvidenceSubject, use evidenceConnection with where and orderBy to filter and sort results.

query FilteredSubjectEvidence {
  evidence {
    searchEvidence(
      where: {
        hasSubjectWith: {
          repositoryKey: "docker-local"
          path: "my-app/latest"
          name: "manifest.json"
        }
      }
      first: 1
    ) {
      edges {
        node {
          subject {
            fullPath
            evidenceConnection(
              where: {
                verified: true
                predicateCategory: "distribution"
                createdAfter: "2024-01-01T00:00:00Z"
              }
              orderBy: { field: CREATED_AT, direction: DESC }
              first: 10
            ) {
              totalCount
              edges {
                node {
                  evidenceId
                  predicateType
                  verified
                  createdAt
                }
              }
            }
          }
        }
      }
    }
  }
}

Application Version Query (AppTrust Federation)

The following example fetches an application version from the AppTrust service and retrieves its associated evidence. The applications entry point and its evidence field shape belong to the AppTrust subgraph. Evidence fields are resolved by the Evidence service via federation on EvidenceSubject.

query GetApplicationVersionWithEvidence {
  applications {
    getApplicationVersion(
      applicationKey: "my-app"
      version: "1.0.0"
    ) {
      application {
        key
        displayName
      }
      version
      tag
      createdAt
      createdBy
      status
      releaseStatus

      evidence(first: 10, verified: true) {
        evidenceId
        name
        predicateType
        predicateCategory
        verified
        createdAt
        createdBy
        subject {
          fullPath
          repositoryKey
          path
          name
          entityType
          entityId
        }
      }
    }
  }
}

Response:

{
  "data": {
    "applications": {
      "getApplicationVersion": {
        "application": {
          "key": "my-app",
          "displayName": "My Application"
        },
        "version": "1.0.0",
        "tag": "release-v1.0.0",
        "createdAt": "2024-11-20T10:00:00Z",
        "createdBy": "ci-system",
        "status": "COMPLETED",
        "releaseStatus": "RELEASED",
        "evidence": [
          {
            "evidenceId": "evidence-123",
            "name": "build-attestation",
            "predicateType": "https://slsa.dev/provenance/v1",
            "predicateCategory": "BUILD",
            "verified": true,
            "createdAt": "2024-11-20T10:15:00Z",
            "createdBy": "ci-system",
            "subject": {
              "fullPath": "npm-local/artifacts/my-app/1.0.0",
              "repositoryKey": "npm-local",
              "path": "artifacts/my-app",
              "name": "1.0.0",
              "entityType": "application-version",
              "entityId": "my-app/1.0.0"
            }
          }
        ]
      }
    }
  }
}

Did this page help you?