Skip to content

feat: broaden telemetry channel attribution and add batch-commit event - #7643

Open
claude[bot] wants to merge 5 commits into
mainfrom
feat/telemetry-channel-attribution
Open

feat: broaden telemetry channel attribution and add batch-commit event#7643
claude[bot] wants to merge 5 commits into
mainfrom
feat/telemetry-channel-attribution

Conversation

@claude

@claude claude Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Requested by Andrew Huang · Slack thread

Context

Phase 0 of the telemetry channel-attribution work. Five targeted fixes:

Before

  • ~80% of secrets pulled traffic lands in channel other because getUserAgentType only recognizes cli, k8-operator, terraform, browsers, and the legacy InfisicalNodeSDK/InfisicalPythonSDK UA strings. Everything built on the go-sdk (CSI provider, agent injector), the ruby/rust/cpp/dotnet SDKs, the current python/nodejs SDKs, and the external-secrets operator all fall through to other. The backend-go port additionally misclassifies versioned k8-operator/x.y.z UAs as other.
  • Machine Identity Login events carry no client/channel info at all, and the aggregated secrets pulled / Machine Identity Login events histogram-ize channel, so channel breakdowns are not possible in PostHog.
  • Web Batch Edit commits (POST /api/v1/pit/batch/commit) emit no secret-mutation telemetry event.

After

  • getUserAgentType (Node backend and backend-go, kept in sync) additionally recognizes infisical-go-sdk, k8-external-secrets-operator, infisical-ruby-sdk, Infisical.Sdk (dotnet), infisical-rs (rust), infisical-cpp-sdk, both bare and versioned (<ua>/x.y.z). infisical-python-sdk and infisical-nodejs-sdk map to the existing InfisicalPythonSDK/InfisicalNodeSDK channels. A new infisical-agent channel captures the agent's UA introduced by feat(telemetry): org attribution, agent user-agent, and working opt-out cli#360 (which switches the agent from UA cli to infisical-agent/<version>), so agent volume separates from interactive CLI. All existing matches are preserved exactly.
  • backend-go now also matches versioned k8-operator/x.y.z UAs, matching the Node behavior.
  • channel is an aggregation breakdown dimension for secrets pulled and Machine Identity Login, so each channel yields its own aggregated event with a flat, filterable channel property.
  • Every Machine Identity Login emission (all 11 identity auth routers) records channel from the request UA.
  • The PIT batch/commit handler emits a secrets pushed event (with isBatchCommit: true, numberOfSecrets from the change count, plus the standard projectId/environment/secretPath/channel/actorType properties), following the v3/v4 secret-router emission pattern.

No endpoint request/response schemas change. All changes are additive: new UserAgentType enum members (stored as free strings in audit logs; the optional audit-log userAgentType filter accepts the new values), new optional PostHog event properties, and one new server-side telemetry emission.

Pairs with Infisical/cli#360 for the infisical-agent user agent.

How

  • backend/src/server/plugins/audit-log.ts – broaden getUserAgentType with exact-or-versioned matching for the new UAs
  • backend/src/ee/services/audit-log/audit-log-types.ts – new UserAgentType members
  • backend-go/internal/services/auditlog/useragent.go – mirror of the Node matcher + versioned k8-operator/ fix
  • backend/src/services/telemetry/telemetry-service.tschannel breakdown dimension for SecretPulled and MachineIdentityLogin
  • backend/src/services/telemetry/telemetry-types.ts – optional channel on TMachineIdentityLoginEvent, optional isBatchCommit on TSecretModifiedEvent
  • backend/src/server/routes/v1/identity-*-auth-router.ts (11 files) – record channel on Machine Identity Login
  • backend/src/ee/routes/v1/pit-router.ts – emit secrets pushed after a successful batch commit

Steps to verify the change

  • Send requests with UAs like infisical-go-sdk/v0.4.0, infisical-agent/1.2.3, k8-operator/0.11.4 and confirm audit logs / PostHog events carry the expected channel
  • Perform a machine identity login and confirm the Machine Identity Login event carries channel
  • Commit a web Batch Edit and confirm a secrets pushed event with isBatchCommit: true is emitted
  • go build ./... in backend-go passes

Type

  • Improvement

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Updated CLAUDE.md files (if needed)
  • Read the contributing guide

Generated by Claude Code

- Recognize SDK and integration user agents (go, ruby, python, nodejs,
  dotnet, rust, cpp SDKs, k8s external secrets operator) and the new
  infisical-agent UA in getUserAgentType, in both the Node backend and
  the backend-go port
- Fix backend-go missing versioned k8-operator/x.y.z UA match
- Add channel as an aggregation breakdown dimension for secrets pulled
  and Machine Identity Login aggregated events
- Record channel on Machine Identity Login emissions across all
  identity auth routers
- Emit a secrets pushed event (marked isBatchCommit) from the PIT
  batch/commit handler
@andrewhuhh
andrewhuhh marked this pull request as ready for review August 12, 2026 13:21
@andrewhuhh andrewhuhh self-assigned this Aug 12, 2026
@andrewhuhh
andrewhuhh requested a review from akhilmhdh August 12, 2026 13:22
@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR broadens user-agent channel attribution across the Node and Go backends and adds channel-aware identity-login and secret telemetry.

  • Adds classifications and display labels for more SDKs, operators, and the Infisical agent.
  • Adds channel breakdowns to aggregated telemetry and identity-login events.
  • Emits secret-push telemetry after successful PIT batch commits.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
backend/src/server/plugins/audit-log.ts Expands Node user-agent classification with exact and versioned matches for additional clients.
backend-go/internal/services/auditlog/useragent.go Mirrors the expanded classification behavior in the Go backend.
backend/src/services/telemetry/telemetry-service.ts Adds channel as an aggregation breakdown for secret pulls and machine-identity logins.
backend/src/ee/routes/v1/pit-router.ts Emits secret-push telemetry for successfully applied batch secret changes.
backend/src/server/routes/v1/identity-universal-auth-router.ts Adds classified request-channel attribution to universal-auth machine-identity login telemetry.

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment on lines +33 to +45
const exactOrVersionedMatches = [
UserAgentType.AGENT,
UserAgentType.K8_EXTERNAL_SECRETS_OPERATOR,
UserAgentType.GO_SDK,
UserAgentType.RUBY_SDK,
UserAgentType.DOTNET_SDK,
UserAgentType.RUST_SDK,
UserAgentType.CPP_SDK
];
for (const match of exactOrVersionedMatches) {
if (userAgent === match || userAgent.startsWith(`${match}/`)) {
return match;
}

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.

P2 User-agent parity lacks tests

The expanded classification contract is duplicated across Node and Go without parity tests for the new exact, versioned, and legacy alias cases. A later one-sided change to ordering, casing, or prefix handling would silently produce different telemetry and audit-log attribution between the two backends.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f2eedc1e7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread backend/src/ee/routes/v1/pit-router.ts Outdated
Comment thread backend/src/ee/services/audit-log/audit-log-types.ts
@gitguardian

gitguardian Bot commented Aug 17, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
35997175 Triggered Username Password 0427b76 backend/src/ee/services/dynamic-secret/providers/models.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@andrewhuhh

Copy link
Copy Markdown
Contributor

@greptile review

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.

2 participants