Skip to content

fix: prevent OTLP token environment-file injection - #70597

Merged
pelikhan merged 1 commit into
mainfrom
pelikhan-issue-70460-aw-top-10-02-sanitize-otlp-token-before-ddcf25
Oct 20, 2026
Merged

pelikhan merged 1 commit into
mainfrom
pelikhan-issue-70460-aw-top-10-02-sanitize-otlp-token-before-ddcf25

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

  • Ignore OTLP OIDC tokens containing CR/LF before merging them into headers or endpoint configuration.
  • Make writeEnvLine refuse keys or values containing CR/LF and issue a warning that never includes rejected data.
  • Add LF, CR, and CRLF regressions for tokens, merged headers, and writer keys/values while preserving valid single-line behavior and trace propagation.

Fixes #70460
Fixes #70120

Validation

  • Reproduced the token and merged-header injection failures before the fix.
  • npm run test:js -- action_setup_otlp.test.cjs action_conclusion_otlp.test.cjs action_otlp.test.cjs — 128 tests passed.
  • make fmt-cjs && make lint-cjs — passed (existing repository warnings only).
  • PATH="/opt/homebrew/bin:$PATH" make agent-report-progress — passed, including build, JavaScript typecheck/lint, and all 74 setup tests.

Reject CR/LF-containing OTLP OIDC tokens before merging credentials and guard writes to GitHub Actions environment/output files. Cover malformed tokens, merged headers, and writer keys/values without exposing rejected data.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 20, 2026 18:54
Copilot AI max review requested due to automatic review settings October 20, 2026 18:54
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · sonnet50 · 13.3 AIC · ⌖ 15.1 AIC · ◇ 6.57 AIC · ⊞ 12.6K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · opus55 · 11.1 AIC · ⌖ 31.8 AIC · ◇ 16.5 AIC · ⊞ 1.9K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · 5.47 AIC · ⌖ 5.36 AIC · ⊞ 14.7K · ◷

Generated by Ponytail Reviewer for #70597

@github-actions github-actions Bot 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.

Verdict

No actionable blocking issues found in the changed lines. The CR/LF rejection is applied before writing runner environment files, and the added regressions cover LF, CR, and CRLF cases without exposing rejected data. Static review only; tests were not rerun.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · 1.48 AIC · ⌖ 0.539 AIC · ⊞ 1.6K
Comment /review to run again

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.

🟢 Approval recommended

The localized guards address the injection path, with focused regression coverage and no blocking issues identified.

No open issues 🎉

What changed in this PR

Prevents OTLP token data from injecting environment variables during workflow setup.

Changes:

  • Rejects tokens and environment-file keys or values containing CR/LF.
  • Adds regression coverage for rejected inputs, secret-safe warnings, and valid single-line behavior.
File Description
actions/​setup/​js/​action_setup_otlp.test.cjs Adds token, merged-header, and writer regression tests.
actions/​setup/​js/​action_setup_otlp.cjs Adds newline guards before token merging and file writes.

Review effort: Max

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to the code quality notification: accepted as informational, with no code changes needed. The accompanying review found no actionable blocking issues in the changed lines.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to the Test Quality Sentinel notification: accepted as informational, with no code changes requested. The reported_no_action status is not evidence of passing tests; validation is documented separately in the PR description.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to the Matt Pocock Skills Reviewer notification: accepted as a review-start status only. It contains no actionable feedback, so no code changes are needed for this comment.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to the Design Decision Gate notification: accepted as informational, with no design change or ADR requested. The reported_no_action status alone does not establish validation, and this comment provides no actionable change to implement.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to the Ponytail Reviewer notification: accepted as informational, with no code changes requested. The reported_no_action status is not treated as validation evidence.

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd (per pr-triage) — the fix is solid and the regression is well covered. Approving with one minor optional test-coverage suggestion.

📋 Key Themes & Highlights

Key Themes

  • Root cause addressed, not just symptom (/diagnosing-bugs): the fix gates at the single inputOTLPOIDCToken entry point rather than patching mergeAuthorizationHeader in isolation, so a CRLF-tainted token can never reach the header/endpoint merge or the GITHUB_ENV write. This is a cleaner single-choke-point design than the inline-stripping approach originally suggested in the linked issue, and it avoids silently mutating a credential.
  • Non-leaking warnings: both new guards (writeEnvLine and the token check) call core.warning with a generic message and never log the rejected key/value/token — tests explicitly assert the malicious payload never appears in core.info/core.warning calls. Good defensive logging discipline.
  • Test coverage (/tdd): it.each(["\n", "\r", "\r\n"]) parametrization covers all three line-break variants for both the generic writeEnvLine guard and the OIDC-token-specific guard, plus a "preserves valid single-line values" regression test guards against false positives. Left one minor inline suggestion for a dedicated GH_AW_OTLP_ENDPOINTS-path test (currently only implicitly covered via the shared writeEnvLine guard).

Positive Highlights

  • ✅ Rejecting the whole tainted value rather than sanitizing/stripping avoids producing a validly-formatted-but-wrong credential
  • ✅ writeEnvLine guard is defense-in-depth that also protects other call sites (trace-id/span-id/output writes), not just the OIDC token path
  • ✅ Closes both linked vulnerability reports (env-file injection and HTTP header injection via OTLP headers) at the same choke point

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 140.3 AIC · ⌖ 15 AIC · ⊞ 10.1K
Comment /matt to run again

Comment thread actions/setup/js/action_setup_otlp.test.cjs
@pelikhan
pelikhan merged commit 4b01533 into main Oct 20, 2026
80 checks passed
@pelikhan
pelikhan deleted the pelikhan-issue-70460-aw-top-10-02-sanitize-otlp-token-before-ddcf25 branch October 20, 2026 19:22
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.93.0

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.

[AW Top 10] 02 Sanitize OTLP token before writing to GITHUB_ENV [setup-security] Environment Variable Injection via OTLP Token in GitHub Actions Step

2 participants