← Back to Pull requests

[DSEC-79] Add datasecurity Autodiscovery Provider #54136

Closed
unknown closed this pull request without merging on Jul 30, 2026 16:25 UTC
View on GitHub
unknown unknown commented on Jul 27, 2026 15:43 UTC
Author

<!--Please give us some feedback on your experience writing this PR ! https://app.datadoghq.com/forms/43db4c02-6837-400c-8083-692e141b1b88 !-->

[!NOTE]

The datasecurity Autodiscovery provider is disabled by default (gated behind data_security.enabled and shared_library_check.enabled, both default to false), so there is no behavior change unless explicitly enabled.

What does this PR do?

Adds a datasecurity Autodiscovery config provider that turns Data Security DB scan tasks received over Remote Configuration into one-off runs of the datasecurity Rust check.

It follows the same provider pattern as the datastream providers, with the flow:

1. Registered only when data_security.enabled and shared_library_check.enabled are set to true (off by default), then waits until at least one postgres integration is configured before subscribing to RC.
2. Subscribes to RC product DATA_SECURITY_DB_SCAN_TASKS.
3. On each RC scan task, resolves the local database connection by matching the task's entity against the configured postgres instances following the same spirit of Data Observability.
4. Builds and schedules a one-off datasecurity check (min_collection_interval: 0) with the resolved connection.

Motivation

Implements the Data Security RFC, reusing the same Autodiscovery-provider pattern as the Kafka actions provider (see POC #53908) and the Data Observability query actions for matching and extracting postgres auth info.

Describe how you validated your changes

Validated end-to-end on a host that has an available postgres database configured through a postgres integration instance.

Since DATA_SECURITY_DB_SCAN_TASKS is not provisioned yet, the scan task was pushed over the generic DEBUG RC product. The provider matched the task entity against the local postgres instance, resolved the connection, and scheduled a one-off datasecurity check. The Rust check was triggered and sent the scan results to the sds-result EVP intake.

Example RC payload used to trigger the scan:

<details>
<summary>DATA_SECURITY_DB_SCAN_TASKS RC payload (pushed via DEBUG)</summary>

{
  "task_id": "15B1C5DC-DA04-4060-8FBD-A542472134A8",
  "scanning_rules": [
    {
      "id": "2b9d78a5-f32d-5ecf-9d97-8fb8f0bb0392",
      "pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]+",
      "suppressions": {
        "starts_with": [
          "alice"
        ]
      }
    },
    {
      "id": "581ae10c-56e7-51a8-afd0-091dfa4a1df7",
      "pattern": "(?:\\d{1,3}\\.){3}\\d{1,3}"
    }
  ],
  "scan_data": [
    {
      "sub_task_id": "CF28D7AC-249D-4970-B076-87D71586B654",
      "entity": {
        "platform": "postgres",
        "database_cluster_name": "local-dev-cluster",
        "database_instance_name": "local-dev-instance",
        "database_host_name": "localhost",
        "database": "dbm",
        "schema": "public",
        "table": "users"
      },
      "query": "SELECT * FROM users",
      "timeout_seconds": 30
    },
    {
      "sub_task_id": "455ECD24-5C11-45AA-801B-5C2C43C8533C",
      "entity": {
        "platform": "postgres",
        "database_cluster_name": "local-dev-cluster",
        "database_instance_name": "local-dev-instance",
        "database_host_name": "localhost",
        "database": "dbm",
        "schema": "public",
        "table": "movies"
      },
      "query": "SELECT * FROM movies",
      "timeout_seconds": 30
    }
  ]
}

</details>

Generated docker image with the rust check shipped:

  • Docker image: registry.ddbuild.io/ci/datadog-agent/agent:v127635035-7bcede75-7-amd64

  • CI Link: CI
  • Additional Notes

  • The provider is gated behind data_security.enabled (default false), so there is no behavior change unless explicitly enabled.
  • Action items

  • Disable the datasecurity check before merge. It was enabled (commit datasecurity: enable datasecurity check) only to validate end-to-end; keeping it packaged bundles the ~3.66 MiB .so and fails the static quality gates.
  • Diff: 561 lines (+420 / -141) across 7 files Reviewer: vinckama Review duration: 4361m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.73) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 561 lines diff across 7 files
    0.73
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.379
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.073
    Real PR Conversation Timeline
    1 comments
    "Review active on #54136"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 72.9% (HIGH) · Higher = larger blast radius
    72.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 28.8% · Safe to merge
    28.8%