Skip to content

Conversation

@petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Jan 23, 2026

This PR improves telemetry safety by introducing explicit control over which command arguments are included in telemetry events, preventing accidental capture of sensitive data like secrets and credentials.

Replaces #11856
Builds on top of #12069 and Builds on top of #12071

  • Renamed telemetry fields for clarity:

    • command → safeCommand (now excludes the "wrangler " prefix, e.g., "d1 list" instead of "wrangler d1 list")
    • args → safeArgs (explicitly indicates these are sanitized/safe arguments)
  • Added logArgs control:

    • New logArgs: boolean field in telemetry events and command metadata
    • Commands must explicitly opt-in via metadata.logArgs: true to have their arguments logged
    • When logArgs: false (default), safeArgs is sent as an empty object {}
  • Opted-in safe commands (~100 commands) that don't handle sensitive input:

    • List/info/get commands (d1 list, kv list, r2 bucket list, etc.)
    • Read-only operations (docs, tail, type-generation, etc.)
    • Commands with non-sensitive arguments (delete by name, deployments, etc.)
  • Intentionally excluded sensitive commands:

    • secret put, secret delete, secret bulk (handle secret values)
    • pages secret put, pages secret delete, pages secret bulk
    • hyperdrive create, hyperdrive update (contain connection strings)
  • Tests

    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation

    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix

A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@changeset-bot
Copy link

changeset-bot bot commented Jan 23, 2026

🦋 Changeset detected

Latest commit: 5a78386

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12063

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12063

miniflare

npm i https://pkg.pr.new/miniflare@12063

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12063

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12063

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12063

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12063

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12063

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12063

wrangler

npm i https://pkg.pr.new/wrangler@12063

commit: 5a78386

// (used when yargs validation errors occur before handler runs)
command = `wrangler ${args._.join(" ")}`;
metricsArgs = args;
safeCommand = args._.join(" ");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MattieTK - do we want this just to be "" since we cannot guarantee that the args don't contain something sensitive?

@petebacondarwin petebacondarwin force-pushed the pbd/clean-command-metrics branch from 3fd5325 to 7e9344a Compare January 23, 2026 14:16
@petebacondarwin petebacondarwin force-pushed the pbd/safe-command-args-metrics branch 2 times, most recently from bd603d8 to 2e40a31 Compare January 23, 2026 16:27
@petebacondarwin petebacondarwin changed the base branch from pbd/clean-command-metrics to pbd/wrangler/migrate-containers-to-define-command January 23, 2026 16:27
@petebacondarwin petebacondarwin force-pushed the pbd/wrangler/migrate-containers-to-define-command branch from a073093 to db843d1 Compare January 23, 2026 18:01
@petebacondarwin petebacondarwin force-pushed the pbd/safe-command-args-metrics branch from 2e40a31 to 3ad4dd8 Compare January 24, 2026 12:22
- Rename 'command' to 'safeCommand' (without 'wrangler ' prefix) and 'args' to 'safeArgs' in telemetry events
- Add 'logArgs' boolean to control whether command arguments are included in telemetry
- Commands must explicitly opt-in via metadata.logArgs: true to log arguments
- Safe commands (list, info, get, etc.) that don't handle sensitive data opt-in to logging
- Sensitive commands (secret put/delete/bulk, hyperdrive create) intentionally do not opt-in
- Update fallback telemetry in index.ts to use new format with logArgs: false
@petebacondarwin petebacondarwin force-pushed the pbd/safe-command-args-metrics branch from 3ad4dd8 to 5a78386 Compare January 24, 2026 14:09
@petebacondarwin petebacondarwin marked this pull request as ready for review January 24, 2026 14:09
@petebacondarwin petebacondarwin requested review from a team as code owners January 24, 2026 14:09
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

1 participant