Skip to content

feat(trace): add --no-capture flag to omit command arguments from reported spans#2380

Merged
Drarig29 merged 2 commits into
DataDog:masterfrom
eliebleton-manomano:feat/trace-no-capture
Jun 26, 2026
Merged

feat(trace): add --no-capture flag to omit command arguments from reported spans#2380
Drarig29 merged 2 commits into
DataDog:masterfrom
eliebleton-manomano:feat/trace-no-capture

Conversation

@eliebleton-manomano

@eliebleton-manomano eliebleton-manomano commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #2379

What and why?

datadog-ci trace -- <cmd> always reports the full command line, including every argument, in the span's command field (and uses it as the default name). When arguments carry secrets (tokens, passwords, signed URLs), those values are sent to Datadog and surface in the CI Visibility UI.

datadog-ci trace -- ./deploy.sh --token "$SECRET"
# reported command/name: "./deploy.sh --token <SECRET>"

How?

Add --no-capture (default: false): when set, only the executable name is reported instead of the full command line. The child process is still launched with all of its arguments — only what we report is trimmed. When --name is not provided, the span name also falls back to the executable name so arguments don't leak via the default name; an explicit --name is still honored.

datadog-ci trace --no-capture -- ./deploy.sh --token "$SECRET"
# reported command/name: "./deploy.sh"

Scope: --no-capture only affects the reported command/name. User-supplied --tags, --measures, and DD_TAGS are reported as-is, since the user controls those explicitly.

Adds unit tests for all three behaviours (default captures the full line, --no-capture trims to the executable, --no-capture still honors --name) and documents the flag in the command README and --help examples.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

…orted spans

`datadog-ci trace -- <cmd>` always reports the full command line, including
every argument, in the span's `command` field (and uses it as the default
`name`). When arguments carry secrets (tokens, passwords, signed URLs), those
values are sent to Datadog and surface in the CI Visibility UI.

Add `--no-capture` (default: false): when set, only the executable name is
reported instead of the full command line. The child process is still launched
with all of its arguments — only what we report is trimmed. When `--name` is
not provided, the span name also falls back to the executable name so arguments
don't leak via the default name; an explicit `--name` is still honored.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Drarig29 Drarig29 changed the title feat(trace): add --no-capture flag to omit command arguments from reported spans feat(trace): add --no-capture flag to omit command arguments from reported spans Jun 26, 2026

@juan-fernandez juan-fernandez 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.

thanks for this!

@Drarig29 Drarig29 added the software-delivery Related to [coverage, deployment, dora, junit, measure, tag, trace] label Jun 26, 2026
@datadog-official

datadog-official Bot commented Jun 26, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

Continuous Integration | Test standalone binary in Alpine   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6143f7f | Docs | Datadog PR Page | Give us feedback!

@Drarig29
Drarig29 merged commit e538443 into DataDog:master Jun 26, 2026
33 of 34 checks passed
@ava-silver ava-silver mentioned this pull request Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

software-delivery Related to [coverage, deployment, dora, junit, measure, tag, trace]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trace: add --no-capture flag to keep command arguments out of reported spans

4 participants