Skip to content

Oracle DataSafe (Database Security) Executor

Category: Database and SAP Security Script: oracle_datasafe.py Integration: REST API (OCI request signing) Faraday Plugin: Raw JSON Website: https://www.oracle.com/security/database-security/data-safe/

Description

Imports Oracle Data Safe security assessment findings into Faraday. The executor lists the registered target databases and their findings for an OCI compartment, and creates one Faraday host per target database with its findings as vulnerabilities.

Prerequisites

  • An Oracle Cloud Infrastructure tenancy with Data Safe enabled and target databases registered
  • An OCI user with an API signing key and an IAM policy that allows reading Data Safe target databases and findings
  • The private key (PEM file) readable by the agent, plus the user OCID, tenancy OCID and key fingerprint
  • The cryptography and requests Python packages in the agent environment
  • Network access to the Data Safe endpoint of your region

Configuration

Environment Variables (Setup)

Variable Required Description
OCI_USER_OCID Yes OCID of the OCI user that owns the API key (ocid1.user.oc1..<id>)
OCI_TENANCY_OCID Yes OCID of your tenancy (ocid1.tenancy.oc1..<id>)
OCI_FINGERPRINT Yes Fingerprint of the API key, as 16 colon-separated hex bytes (e.g., 12:34:56:78:9a:bc:de:f0:12:34:56:78:9a:bc:de:f0)
OCI_PRIVATE_KEY_PATH Yes Path to the PEM private key of the API key, as seen by the agent
OCI_REGION No* OCI region identifier (e.g., us-ashburn-1). Used to build the endpoint https://datasafe.<region>.oci.oraclecloud.com.
OCI_HOST No* Data Safe endpoint URL. Overrides the endpoint built from OCI_REGION, for example for government or dedicated realms.

* Set at least one of OCI_REGION or OCI_HOST.

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

Execution Arguments

Parameter Type Mandatory Description
OCI_COMPARTMENT_ID string Yes OCID of the compartment to import from, including its sub-compartments (ocid1.compartment.oc1..<id>, or the tenancy OCID for the root compartment)
DATASAFE_TARGET_ID string No OCID of a single Data Safe target database to import (default: all targets in the compartment)
DS_MIN_SEVERITY string No Minimum severity to import: info, low, medium, high or critical (default: info)

YAML Configuration Example

executors:
  oracle_datasafe:
    repo_executor: oracle_datasafe.py
    max_size: 65536
    varenvs:
      OCI_USER_OCID: "ocid1.user.oc1..<id>"
      OCI_TENANCY_OCID: "ocid1.tenancy.oc1..<id>"
      OCI_FINGERPRINT: "12:34:56:78:9a:bc:de:f0:12:34:56:78:9a:bc:de:f0"
      OCI_PRIVATE_KEY_PATH: "/keys/oci_api_key.pem"
      OCI_REGION: "us-ashburn-1"
      OCI_HOST: "https://datasafe.us-ashburn-1.oci.oraclecloud.com"
    params:
      OCI_COMPARTMENT_ID:
        mandatory: true
        type: string
        base: string
      DATASAFE_TARGET_ID:
        mandatory: false
        type: string
        base: string
      DS_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string

How It Works

  1. Loads the private key and signs each request with OCI Signature v1 (RSA-SHA256), using the tenancy, user and fingerprint as key ID
  2. Lists target databases from {endpoint}/20181201/targetDatabases for the compartment and its sub-compartments, or for DATASAFE_TARGET_ID only
  3. Lists findings from {endpoint}/20181201/findings with the same scope, following OCI's page cursor until the last page
  4. Converts each finding into a vulnerability with severity, description and remediation, and drops those below DS_MIN_SEVERITY
  5. Attaches the vulnerabilities to the host of their target database

Notes

  • Each Data Safe target database becomes a host. Its IP is taken from the target's details when present, otherwise 0.0.0.0, and its OS field shows the Oracle Database version and target state.
  • Findings whose target is not in the catalogue get their own host, and findings with no target go to a host with IP 0.0.0.0.
  • If nothing is returned, the executor creates one empty placeholder host (0.0.0.0) to record the run.
  • A 401 response stops the run. A 403, 404 or other error ends the affected query and is written to the agent log.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use DS_MIN_SEVERITY to filter by severity.