SecureCore

SecureCore Project (CodeCertify module) Meta Data

Retrieve SecureCore project with associated last 10 scans and meta data including component, vulnerability, license and asset metrics

import requests

# Define the GraphQL endpoint URL
url = "https://app.threatrix.io/graphql"
apikey = "{THREATRIX_API_OR_SERVICE_KEY}" # Replace with your actual service key

# Example GraphQL query - adjust based on your needs
query = """
{
  project(projectId: "{PROJECT_ID}") {
    projectId
    parentProjectId
    entityId
    orgId
    name
    tags
    projectMetricsGroup {
      projectMetrics {
        measureDate
        vulnerabilityMetrics {
          severityMetrics
          __typename
        }
        assetMetrics {
          assetCompositionMetrics
          __typename
        }
        componentMetrics {
          vulnerabilityMetrics
          licenseCategoryMetrics
          licenseFamilyMetrics
          licenseNameMetrics
          __typename
        }
        licenseMetrics {
          licenseCategoryMetrics
          licenseFamilyMetrics
          licenseNameMetrics
          __typename
        }
        supplyChainMetrics {
          supplyChainMetrics
          __typename
        }
        __typename
      }
      __typename
    }
    scans(first: 10) {
      totalCount
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
        __typename
      }
      edges {
        node {
          scanId
          orgId
          projectId
          branch
          tag
          version
          versionHash
          created
          status
          errorMsg
          log
          otMetaData
          scanAssets {
            otCount
            __typename
          }
          components {
            totalCount
            __typename
          }
          scanMetricsSummary(isComposite: true) {
            componentCountMetrics {
              totalCount
              riskyLicenses
              vulnerableComponents
              __typename
            }
            vulnerabilityMetrics {
              critical
              high
              medium
              low
              info
              unassigned
              __typename
            }
            componentVulnerabilityMetrics {
              critical
              high
              medium
              low
              info
              unassigned
              __typename
            }
            licenseMetrics {
              copyleftStrong
              copyleftWeak
              copyleftPartial
              copyleftLimited
              copyleft
              custom
              dual
              permissive
              proprietary
              proprietaryFree
              __typename
            }
            assetMetrics {
              embedded
              openSource
              unique
              __typename
            }
            __typename
          }
          __typename
        }
        __typename
      }
      __typename
    }
    __typename
  }
}


"""

# Define the headers with the Bearer token for authentication
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer "+apikey,  
}

# Define the payload to send with the request
payload = {
    "query": query
}

# Make the request to the GraphQL endpoint
response = requests.post(url, json=payload, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Print the response data
    print("Response data:", response.json())
else:
    print(f"Request failed with status code {response.status_code}")

Components, Vulnerabilites & Licenses

Retrieve list of first 25 components, vulnerabilities and licenses for SecureCore project, in a single query. See below for individual queries.

Components

Retrieve list of first 25 components for SecureCore project.

Vulnerabilities

Retrieve list of first 25 vulnerabilities for SecureCore project.

Licenses

Retrieve list of first 25 licenses for SecureCore project.

Last updated