Skip to content

feat(agent-config): make TLS provider opt-in for transitive libdd deps#136

Merged
duncanista merged 2 commits into
mainfrom
chore/agent-config-fips-feature
Jun 10, 2026
Merged

feat(agent-config): make TLS provider opt-in for transitive libdd deps#136
duncanista merged 2 commits into
mainfrom
chore/agent-config-fips-feature

Conversation

@duncanista

Copy link
Copy Markdown
Contributor

What does this PR do?

Switch `libdd-trace-utils` and `libdd-trace-obfuscation` deps inside `datadog-agent-config` to `default-features = false`, and expose two new crate features so consumers pick the TLS provider explicitly:

  • `https` → enables `libdd-trace-{utils,obfuscation}/https` (ring-backed)
  • `fips` → enables `libdd-trace-{utils,obfuscation}/fips` (aws-lc-rs-backed)

The default feature set is now empty.

Motivation

The crate itself never reaches for TLS — it only ever uses `parse_rules_from_string` from `libdd-trace-obfuscation` and a couple of URL helpers from `libdd-trace-utils`. But by depending on those crates with their `default` features (which include `https` and pull `hyper-rustls` + `ring`), the choice of crypto provider leaked into every downstream consumer.

This bit `datadog-lambda-extension` (bottlecap), which builds a FIPS-compliant variant of its binary. Bottlecap activates `libdd-/fips` via its own `fips` feature, but because Cargo feature unification is additive, the implicit `libdd-/default` pulled in via `datadog-agent-config` re-enabled the `https` (ring) path alongside, breaking FIPS dependency-graph validation (`ring v0.17 → libdd-common feature "https" → hyper-rustls feature "ring" → rustls-webpki feature "ring"`).

By making the TLS provider opt-in, `datadog-agent-config` becomes crypto-agnostic again. Consumers either enable `https` or `fips` depending on their build, and the FIPS branch is no longer poisoned by an implicit default.

Same treatment applied to the `dogstatsd` workspace dep — it's used only for `parse_metric_namespace`, so default features are disabled.

Additional Notes

Existing consumers that relied on the implicit `https` pull from `datadog-agent-config` need to opt in:

```toml
datadog-agent-config = { ..., features = ["https"] } # or ["fips"]
```

Describe how to test/QA your changes

  • `cargo check -p datadog-agent-config` — clean
  • `cargo test -p datadog-agent-config` — all 71 tests pass
  • Verified bottlecap's FIPS dep tree is clean when `datadog-agent-config` is consumed with `features = ["fips"]` (no `ring` in the dep graph).

libdd-trace-obfuscation and libdd-trace-utils default to their "https"
feature which pulls hyper-rustls with ring crypto. When a consumer needs
FIPS compliance, this default leaks into the dependency graph and
defeats consumer-side fips features (cargo unions features additively,
so default+fips ends up linking both ring and aws-lc-rs).

Switch the libdd deps to default-features = false and expose two new
crate features so consumers pick explicitly:

  https = libdd-trace-{utils,obfuscation}/https   # ring-backed HTTPS
  fips  = libdd-trace-{utils,obfuscation}/fips    # aws-lc-rs HTTPS

The default feature set is empty - the crate itself never needs TLS,
only its libdd transitives can. Existing consumers that relied on
the implicit "https" pull now opt in by setting
`datadog-agent-config = { ..., features = ["https"] }` (or "fips").

Also flips `dogstatsd = { path = "../dogstatsd" }` to
default-features = false for the same reason - dogstatsd's default
features include HTTP send paths that we don't use from agent-config,
and they similarly leak ring/rustls feature flags downstream.

Verified:
  cargo check -p datadog-agent-config      # clean
  cargo test  -p datadog-agent-config      # 71 passed
Copilot AI review requested due to automatic review settings June 10, 2026 16:52
@duncanista duncanista requested review from a team as code owners June 10, 2026 16:52
@duncanista duncanista requested review from duncanpharvey and shreyamalpani and removed request for a team June 10, 2026 16:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes datadog-agent-config crypto/TLS-provider agnostic by disabling default features on transitive libdatadog dependencies and exposing explicit crate features for selecting a TLS provider when needed.

Changes:

  • Disable default-features for libdd-trace-utils and libdd-trace-obfuscation to avoid implicitly pulling a TLS provider into downstream consumers.
  • Add opt-in crate features https and fips that forward to the corresponding libdd-trace-{utils,obfuscation} features.
  • Disable default features for the workspace dogstatsd dependency since only a small utility function is used.

Comment thread crates/datadog-agent-config/Cargo.toml Outdated
duncanista added a commit to DataDog/datadog-lambda-extension that referenced this pull request Jun 10, 2026
Bumps datadog-agent-config to the upstream PR branch SHA carrying
DataDog/serverless-components#136 (which switches the libdd deps to
default-features = false and exposes new https/fips features), and
plumbs them through bottlecap's default/fips feature spec so the right
TLS provider is selected per build.

Without this, datadog-agent-config's libdd transitive dependencies
implicitly enabled `https` (ring-backed hyper-rustls) on top of the
fips path that bottlecap activates, leaving both providers in the
dependency graph. The datadog-fips build script then rejected the
build because ring v0.17 was reachable via:

  ring v0.17 -> libdd-common feature "https"
              -> hyper-rustls feature "ring"
              -> rustls-webpki feature "ring"

With agent-config now opting in via consumer features instead of
defaults, the FIPS dep tree is clean again.

Also regenerated LICENSE-3rdparty.csv to include the new
datadog-agent-config package, per the dd-rust-license-tool check.

TODO: re-pin to the merge SHA once
DataDog/serverless-components#136 lands.
Per copilot review on #136 — Cargo doesn't
enforce mutual exclusivity. Reword the doc comment to spell out that
both features can technically be enabled (e.g. via --all-features)
but that doing so defeats the purpose by re-adding ring alongside
aws-lc-rs in the dep graph.
duncanista added a commit to DataDog/datadog-lambda-extension that referenced this pull request Jun 10, 2026
Picks up the doc-comment clarification from the copilot review on
DataDog/serverless-components#136 (https/fips features aren't
Cargo-enforced).
@duncanista duncanista merged commit bb4dede into main Jun 10, 2026
27 checks passed
@duncanista duncanista deleted the chore/agent-config-fips-feature branch June 10, 2026 18:04
duncanista added a commit to DataDog/datadog-lambda-extension that referenced this pull request Jun 10, 2026
DataDog/serverless-components#136 merged at bb4dedeee20b949db3143c05e5a779b843a8a484.
The previous pin was the pre-merge branch SHA used during development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants