← Back to Pull requests

fix(rum): fix CSP metric and align injection reasons #504

Closed
unknown closed this pull request without merging on Nov 25, 2026 13:14 UTC
View on GitHub
unknown unknown commented on Nov 25, 2026 09:55 UTC
Author

Overview

  • Responses with a Content-Security-Policy header are now counted in

  • injection.content_security_policy (tags status:seen, kind:header), not in
    injection.failed.
  • The injection.skipped reason invalid_content_type is renamed to content-type.

  • The injection.failed reason missing_header_tag is renamed to no_injection_point.

  • telemetry.h states the rule: skipped means not tried (decided from headers or config),

  • failed means an eligible HTML response was tried but not injected.

    Motivation

  • The CSP count went to the wrong metric. It adds about 20M bogus injection.failed per week.

  • Align reason names and the skipped/failed rule across nginx, httpd and IIS.
  • Dashboards and monitors change: anything that filters on reason:invalid_content_type,
    reason:missing_header_tag, or on nginx injection.failed, will see different numbers.

    Additional Notes

    Tests: the RUM integration tests now check the telemetry sent to the fake agent, for the CSP
    metric and the content-type skip reason (RUM=ON NGINX_VERSION=1.31.10 make build-musl test,
    cases.rum.test_injection). Locally 12/17 pass, including the content-type check. The 5 tests
    that proxy to a backend on the host (including the CSP test) time out on my machine because the host
    firewall blocks container-to-host traffic. CI must validate the CSP test.

    Manual check in Docker (fake agent, small test backend):

  • CSP header, master: injection.failed with status:seen, kind:header.

  • CSP header, this branch: injection.content_security_policy with status:seen, kind:header.

  • HTML without <head>, this branch: injection.failed with reason:no_injection_point.
  • No hits in DataDog/system-tests for the RUM metric names. invalid_content_type only appears in
    unrelated AppSec tests.

    References

    Jira ticket: INPLAT-1452, INPLAT-1454

    Contributor Checklist

  • I am the author of this pull request and I own it.

  • I reviewed every line of this pull request.

  • This pull request follows the Contributing Guidelines.
  • Diff: 268 lines (+201 / -67) across 3 files Reviewer: pawelchcki Review duration: 199m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 268 lines diff across 3 files
    0.39
    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.335
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #504"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    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: 15.6% · Safe to merge
    15.6%