Skip to content

feat: wire live Configuration into analytics instrumentation - #7133

Closed
nick-y-snyk wants to merge 10 commits into
mainfrom
feat/agent-feedback-secret-redaction-configuration
Closed

feat: wire live Configuration into analytics instrumentation#7133
nick-y-snyk wants to merge 10 commits into
mainfrom
feat/agent-feedback-secret-redaction-configuration

Conversation

@nick-y-snyk

@nick-y-snyk nick-y-snyk commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

  • sendInstrumentation now passes analytics.WithConfiguration(eng.GetConfiguration()) alongside the existing WithLogger(logger) option to GetV2InstrumentationObject, so real CLI invocations opt into GAF's new shape-based secret scrubbing for analytics extension data.
  • No other behavior of sendInstrumentation changes.

Implements ticket 02 of the agent-feedback-secret-redaction spec (see cli-extension-axi repo, .scratch/agent-feedback-secret-redaction/).

Blocked — do not merge yet

This depends on analytics.WithConfiguration, added in go-application-framework#704, which is still open. This branch does not build against the currently-pinned GAF version. Once #704 merges and a GAF version containing it is tagged, cliv2/go.mod needs a real dependency bump before this can merge — that bump is intentionally not included here.

Verified locally against a temporary replace github.com/snyk/go-application-framework => ../../go-application-framework pointed at #704's branch (not included in this diff): builds clean, go vet clean, tests pass.

Test plan

  • go test ./cliv2/pkg/core/... passes (locally, with the temporary GAF replace)
  • New Test_sendInstrumentation_passesEngineConfigurationToInstrumentationObject asserts eng.GetConfiguration() is consulted for the new option via a gomock MockEngine
  • CI — expected to fail until GAF#704 ships and go.mod is bumped for real

PR Type

Enhancement, Dependencies


Description

  • Wire go-application-framework configuration into analytics.

  • Ensure specific sensitive data is excluded from redaction.

  • Update go-application-framework to v0.15.0.


File Walkthrough

Relevant files
Enhancement
2 files
instrumentation.go
Pass engine configuration to analytics instrumentation.   
+8/-2     
main.go
Implement unconditional redaction term population.             
+23/-3   
Tests
2 files
instrumentation_test.go
Add test for analytics configuration passing.                       
+41/-0   
main_test.go
Add tests for redaction term population logic.                     
+47/-0   
Dependencies
4 files
go.mod
Update go-application-framework dependency.                           
+1/-1     
go.sum
Update go.sum for dependency change.                                         
+2/-2     
go.mod
Update go-application-framework dependency.                           
+1/-1     
go.sum
Update go.sum for dependency change.                                         
+2/-2     

sendInstrumentation now passes analytics.WithConfiguration(eng.GetConfiguration())
alongside the existing WithLogger option, so GetV2InstrumentationObject's new
shape-based secret scrubbing (go-application-framework#704) runs on real CLI
invocations, not just library callers who opt in manually.

Blocked from building on this branch alone until go-application-framework#704
merges and is tagged, then go.mod is bumped for real — verified locally against
a temporary `replace github.com/snyk/go-application-framework => ../../go-application-framework`
pointing at that PR's branch, not included in this commit.
@snyk-io

snyk-io Bot commented Aug 14, 2026

Copy link
Copy Markdown

⚠️ Snyk checks are incomplete.

Status Scan Engine Critical High Medium Low Total (0)
⚠️ Open Source Security 0 0 0 0 See details
⚠️ Licenses 0 0 0 0 See details
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Extracts the debug-gated unknown-arg/env-value computation into
populateRedactionTerms and calls it regardless of debugEnabled, setting
configuration.REDACTION_TERMS so the analytics scrub chokepoint can see
these terms even on non-debug runs. writeLogHeader/AddTermsToReplace keep
their exact existing debugEnabled gate.
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️ There are multiple commits on your branch, please squash them locally before merging!
⚠️

"Merge branch 'main' into feat/agent-feedback-secret-redaction-configuration" is too long. Keep the first line of your commit message under 72 characters.

⚠️

"Merge remote-tracking branch 'origin/feat/agent-feedback-secret-redaction-configuration' into feat/agent-feedback-secret-redaction-configuration" is too long. Keep the first line of your commit message under 72 characters.

⚠️

"Merge branch 'main' into feat/agent-feedback-secret-redaction-configuration" is too long. Keep the first line of your commit message under 72 characters.

Generated by 🚫 dangerJS against e13fb8a

@nick-y-snyk
nick-y-snyk marked this pull request as ready for review August 14, 2026 14:27
@nick-y-snyk
nick-y-snyk requested a review from a team as a code owner August 14, 2026 14:28
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

GAF moved REDACTION_TERMS from pkg/configuration to pkg/logging (its only
reader) per PR #704 review feedback. Follows that rename here.
…tion-configuration' into feat/agent-feedback-secret-redaction-configuration
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

Pulls in the analytics extension chokepoint fix (#704): scrub
secret-shaped extension values before marshaling, not the marshaled
JSON bytes, with cycle-guard for self-referential extension maps.
@snyk-pr-review-bot

This comment has been minimized.

go get left stale v0.14.3 hash entries behind; go mod tidy prunes them.
@snyk-pr-review-bot

This comment has been minimized.

sendInstrumentation(context.Background(), mockEngine, instrumentor, &logger)
}

func Test_addClientMachineId(t *testing.T) {

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.

Could you extend this test to verify the machine ID is not redacted by the new logic? More precisely: this test does not use the new scrubbing logic. It may miss the machine ID being replaced

populateRedactionTerms sweeps os.Environ() for unrecognized values and
writes them to logging.REDACTION_TERMS, which the analytics scrub
chokepoint (GAF #704) then redacts wherever it finds them verbatim.
studio::client_machine_id and persona.agent both echo a raw env var
value (INTERNAL_SNYK_CLIENT_MACHINE_ID, AI_AGENT) straight into an
extension, so without this exclusion the chokepoint strips its own
legitimate data back out as "***". Addresses review comment on #7133.
@snyk-pr-review-bot

This comment has been minimized.

@nick-y-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (8c90385)

@robertolopezlopez

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Unresolvable Dependency 🟠 [major]
The PR updates github.com/snyk/go-application-framework to version v0.15.0. However, the PR description acknowledges that this version is not yet tagged or released. This will cause builds to fail in CI and for any developer not using a manual local 'replace' directive.

github.com/snyk/go-application-framework v0.15.0

📚 Repository Context Analyzed

This review considered 14 relevant code sections from 9 files (average relevance: 1.00)

🤖 Repository instructions applied (from AGENTS.md)

what about this @nick-y-snyk

@nick-y-snyk

Copy link
Copy Markdown
Contributor Author

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review
Unresolvable Dependency 🟠 [major]
The PR updates github.com/snyk/go-application-framework to version v0.15.0. However, the PR description acknowledges that this version is not yet tagged or released. This will cause builds to fail in CI and for any developer not using a manual local 'replace' directive.

github.com/snyk/go-application-framework v0.15.0

📚 Repository Context Analyzed
This review considered 14 relevant code sections from 9 files (average relevance: 1.00)

🤖 Repository instructions applied (from AGENTS.md)

what about this @nick-y-snyk

no longer relevant, pr description is different now

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 12 relevant code sections from 7 files (average relevance: 1.00)

🤖 Repository instructions applied (from AGENTS.md)

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