Skip to content

Disable OTLP export when authorization secrets are empty - #58312

Merged
pelikhan merged 5 commits into
mainfrom
copilot/feature-disable-opentelemetry-when-secrets-empty
Sep 4, 2026
Merged

Disable OTLP export when authorization secrets are empty#58312
pelikhan merged 5 commits into
mainfrom
copilot/feature-disable-opentelemetry-when-secrets-empty

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Reusable workflows may receive empty OTLP authorization secrets, causing telemetry exporters to target protected endpoints without credentials.

  • Endpoint filtering

    • Exclude endpoints with empty Authorization or x-sentry-auth headers.
    • Preserve endpoints that intentionally use no authorization header.
  • Runtime propagation

    • Promote the next usable endpoint when one is unavailable.
    • Clear OTLP exporter variables when no usable endpoint remains.
  • Coverage

    • Cover empty authorization, Sentry authorization, unrelated empty headers, endpoint fallback, and exporter disabling.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add conditional to disable opentelemetry if secrets are empty Disable OTLP export when authorization secrets are empty Sep 3, 2026
Copilot AI requested a review from pelikhan September 3, 2026 21:45
@pelikhan
pelikhan marked this pull request as ready for review September 3, 2026 21:46
Copilot AI balanced review requested due to automatic review settings September 3, 2026 21:46

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.

🟡 Changes recommended

Two moderate issues can overwrite explicit exporter overrides and discard valid fallbacks after malformed header parsing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Filters OTLP endpoints with empty authorization credentials and propagates usable fallback exporter settings.

Changes:

  • Rejects empty Authorization and Sentry credentials.
  • Promotes fallback endpoints or disables exporters.
  • Adds filtering and propagation tests.
File summaries
File Review
actions/setup/js/send_otlp_span.test.cjs Adds authorization-filtering coverage.
actions/setup/js/send_otlp_span.cjs Filters unusable endpoints. Moderate: malformed header escapes can discard all valid fallback endpoints.
actions/setup/js/action_setup_otlp.test.cjs Adds fallback and exporter-disabling coverage.
actions/setup/js/action_setup_otlp.cjs Propagates fallback exporter values. Moderate: explicit exporter overrides can be replaced unconditionally.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/setup/js/action_setup_otlp.cjs Outdated
const [primaryEndpoint] = parsedEndpoints;
const endpoint = primaryEndpoint?.url || "";
const headers = primaryEndpoint?.headers || "";
if (endpoint !== (process.env.OTEL_EXPORTER_OTLP_ENDPOINT || "")) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in c527057: exporter values are promoted or cleared only when both still match the unfiltered primary endpoint, preserving explicit overrides.

Comment on lines +876 to +882
function hasEmptyOTLPAuthorizationHeader(raw) {
const headers = parseOTLPHeaders(raw);
return Object.entries(headers).some(([key, value]) => {
const normalizedKey = key.toLowerCase();
return (normalizedKey === "authorization" || normalizedKey === "x-sentry-auth") && value === "";
});
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in c527057: malformed percent-encoded header pairs are skipped individually, so later valid endpoints remain available.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR still has unresolved review feedback.

Please address these review threads and then run the pr-finisher skill:

Also refresh the branch if needed after applying the fixes.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 11.2 AIC · ⌖ 8.62 AIC · ⊞ 9K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR still has unresolved review feedback.

Please address these review threads and then run the pr-finisher skill:

  • preserve explicit OTEL_EXPORTER_OTLP_* overrides instead of replacing user-defined exporter values
  • parse endpoint headers independently so one malformed endpoint does not discard later valid endpoints

Also refresh the branch if needed after applying the fixes.

Generated by 👨🍳 PR Sous Chef

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 32.7 AIC · ⌖ 9.85 AIC · ⊞ 9.2K ·
Comment /souschef to run again

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot This PR still has unresolved review feedback.

Please address these review threads and then run the pr-finisher skill:...

Both requested fixes are present in c527057 and covered by the focused OTLP tests. The branch was refreshed to 211c1bd; the CJS workflow completed successfully on that head.

@pelikhan
pelikhan merged commit 0d11aae into main Sep 4, 2026
11 checks passed
@pelikhan
pelikhan deleted the copilot/feature-disable-opentelemetry-when-secrets-empty branch September 4, 2026 00:00
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.88.4

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.

feature: disable opentelemetry if secrets in the Authorization key are empty

4 participants