Skip to content

Drata Executor

Category: Governance and Compliance Script: drata.py Integration: REST API Faraday Plugin: Raw JSON Website: https://drata.com/

Description

Imports compliance data from Drata into Faraday: failing tests as vulnerabilities, and optionally the monitored assets and the workforce inventory. You choose what to import with DRATA_MODE.

Prerequisites

  • A Drata account with API access
  • A Drata API key (created in Drata under Company Settings > API). Keys are scoped to one workspace, so no workspace ID is needed.
  • Python requests module available to the agent

Configuration

Environment Variables (Setup)

Variable Required Description
DRATA_API_KEY Yes Drata API key, sent as a Bearer token

These variables are also accepted as execution arguments, so a single run can override them.

Execution Arguments

Parameter Type Mandatory Description
DRATA_API_URL string No Drata API base URL (default: https://public-api.drata.com). Change it only for EU or dedicated tenants.
DRATA_MODE string No Comma-separated list of what to import (default: tests): tests (failing tests as vulnerabilities), assets (monitored assets as hosts) and personnel (workforce members as hosts). Any other value stops the run.
DRATA_FRAMEWORK string No Only import tests of this framework ID or key (e.g., soc2, iso27001). Leave blank for all frameworks. Applies to tests only.
DRATA_PAGE_SIZE integer No Records requested per page (default: 100)
DRATA_MAX_PAGES integer No Maximum number of pages to read per mode (default: 50)
DRATA_MIN_SEVERITY string No Minimum severity for failing tests: info, low, medium, high or critical (default: medium). Unrecognized values fall back to medium. Applies to tests only.

All of these parameters can also be set as agent environment variables.

YAML Configuration Example

executors:
  drata:
    repo_executor: drata.py
    max_size: 65536
    varenvs:
      DRATA_API_KEY: "<api_key>"
    params:
      DRATA_API_URL:
        mandatory: false
        type: string
        base: string
      DRATA_MODE:
        mandatory: false
        type: string
        base: string
      DRATA_FRAMEWORK:
        mandatory: false
        type: string
        base: string
      DRATA_PAGE_SIZE:
        mandatory: false
        type: integer
        base: integer
      DRATA_MAX_PAGES:
        mandatory: false
        type: integer
        base: integer
      DRATA_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string

How It Works

  1. Sends Authorization: Bearer <DRATA_API_KEY> with every request and reads each selected mode page by page. If Drata answers 429 (rate limit), it waits 30 seconds and retries up to 3 times.
  2. tests: reads GET /public/tests, skips passing and not-applicable tests and tests below DRATA_MIN_SEVERITY, and creates a [GRC] vulnerability for each one, with its failure reason, frameworks and controls
  3. assets: reads GET /public/assets and creates a host for each monitored asset with an informational [GRC] Drata-monitored asset entry
  4. personnel: reads GET /public/personnel and creates a host for each workforce member with an informational [GRC] Drata workforce member entry
  5. Adds each test to the assets it affects, and removes duplicate vulnerabilities on the same host

Notes

  • Tests that are not linked to any asset are grouped under a host named grc-drata. Assets without an IP address use their external ID, or 0.0.0.0, as the host address.
  • Personnel hosts are identified by the Drata person ID instead of an IP address and named after the person.
  • If Drata returns an error for a page, the records read until then are still imported.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use DRATA_MIN_SEVERITY to filter failing tests by severity.