← Back to Pull requests

[SVLS-10131] allow apiKey with encrypted key options #770

Closed
unknown closed this pull request without merging on Nov 17, 2026 22:36 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 20:39 UTC
Author

What does this PR do?

Lets you keep the plaintext API key off your Lambda functions while still creating monitors.

custom.datadog
  apiKey: ${ssm:/svc/DD_API_KEY}   → deploy-time API calls only (monitors)
  apiKeySsmArn: arn:aws:ssm:...    → Lambda gets DD_API_KEY_SSM_ARN only
  appKey: ${ssm:/svc/DD_APP_KEY}

  • apiKey can now be set alongside apiKeySecretArn, apiKeySsmArn, or apiKMSKey. When it is, the plugin doesn't add DD_API_KEY to the Lambda environment. Setting more than one of the encrypted options still errors.

  • The monitors check accepts the API key and app key from config or environment variables independently, matching how afterDeploy already reads them.

  • Source code integration now prefers apiKey over DATADOG_API_KEY, matching monitors and the Lambda environment.

  • The README documents the pattern.
  • Motivation

    Fixes #766 (SVLS-10131). Monitors need a plaintext API key at deploy time, but setting apiKey also writes the key to the Lambda environment. Pairing apiKey with apiKeySsmArn errored, so users had no way to configure both in serverless.yml.

    Testing Guidelines

    I deployed a Node.js function with Serverless Framework v3 to the sandbox account, using the ddserverless org, then removed the stack, monitor, and SSM parameter.

    | Config | main | This branch |
    |---|---|---|
    | apiKey + apiKeySsmArn + appKey | apiKey and apiKeySsmArn should not be set at the same time. | Deploys; monitor created |
    | DATADOG_API_KEY env + apiKeySsmArn + appKey | When monitors is enabled, DATADOG_API_KEY and DATADOG_APP_KEY environment variables must be set. | Deploys; monitor updated |

    In both cases on this branch:

  • The Lambda environment contains DD_API_KEY_SSM_ARN and no DD_API_KEY.

  • With debug logging, the extension logged Decrypt took 41 ms and Successfully flushed, and traces for the service appeared in Datadog.
  • Additional Notes

    Configs that set apiKey with an encrypted option previously failed validation. The only change for existing configs: if apiKey and DATADOG_API_KEY are both set to different keys, git metadata now uploads with apiKey, the same key the Lambda and monitors already use.

    Types of changes

  • Bug fix

  • New feature

  • Breaking change

  • Misc (docs, refactoring, dependency upgrade, etc.)
  • Check all that apply

  • This PR's description is comprehensive

  • This PR contains breaking changes that are documented in the description

  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future

  • This PR impacts documentation, and it has been updated (or a ticket has been logged)

  • This PR's changes are covered by the automated tests

  • This PR collects user input/sensitive content into Datadog
  • Diff: 355 lines (+266 / -89) across 4 files Reviewer: joepeeples Review duration: 116m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 355 lines diff across 4 files
    0.66
    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.351
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #770"
    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: 65.7% (HIGH) · Higher = larger blast radius
    65.7%
    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: 26.0% · Safe to merge
    26.0%