feat(cli): summary improvements over sensitive data#203
Open
pipeline1987 wants to merge 1 commit intomainfrom
Open
feat(cli): summary improvements over sensitive data#203pipeline1987 wants to merge 1 commit intomainfrom
pipeline1987 wants to merge 1 commit intomainfrom
Conversation
LorrisSaintGenez
approved these changes
Mar 18, 2026
Comment on lines
+30
to
+32
| // sensitiveFlagPattern matches flags that take a secret value; submatch 1 = flag name (e.g. --api-key= or -p ), submatch 2 = value. | ||
| var sensitiveFlagPattern = regexp.MustCompile( | ||
| `(--(?:api-key|application-id|admin-api-key)=)(\S+)|(--(?:api-key|application-id|admin-api-key)\s+)(\S+)|(-p\s+)(\S+)`) |
Contributor
There was a problem hiding this comment.
Do we want to hide -p ? It's profile for most/all commands, might be useful to keep visible
Contributor
There was a problem hiding this comment.
Although I couldn't find a command to see this specific behavior
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
DEBUGis set (any non-empty value), emit one JSON line to stderr at the end of each run (event,invocation_id,command,status,duration_ms, optionalerror). Reuses existingDEBUGinstead of new env vars. Sanitizescommandanderror: API keys, app IDs, and profile values are masked (last 4 chars only, e.g.--api-key=***c123) so logs stay safe.Changes
pkg/cmd/root/run_summary.go+ tests inrun_summary_test.go;root.goonly wiresemitRunSummaryafterExecute.ALGOLIA_CLI_OBSERVABILITY/ALGOLIA_CLI_NON_INTERACTIVE; useDEBUG=1instead.Testing
go test ./pkg/cmd/root/.... Manual:DEBUG=1 ./algolia indices list 2>/tmp/e.txt && tail -1 /tmp/e.txt→ one JSON line, no full secrets.