The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
fix redaction
Justin D'Souza53d9a9db0792
diff --git a/cli/beacon/cmd/endpoint_diagnostics.go b/cli/beacon/cmd/endpoint_diagnostics.goindex 8773cba1..5abb270c 100644--- a/cli/beacon/cmd/endpoint_diagnostics.go+++ b/cli/beacon/cmd/endpoint_diagnostics.go@@ -211,7 +211,11 @@ func runEndpointInventory(cmd *cobra.Command, args []string) error {if err != nil {return err}- configInventory := endpointinventory.Scan(endpointinventory.Options{IncludeContents: endpointOpts.inventoryContents})+ inventorySettings := endpointconfig.InventoryConfig(effectiveCfg)+ configInventory := endpointinventory.Scan(endpointinventory.Options{+ IncludeContents: endpointOpts.inventoryContents || inventorySettings.IncludeContents,+ MaxContentBytes: inventorySettings.MaxContentBytes,+ })result := inventoryResult{GeneratedAt: time.Now().UTC().Format(time.RFC3339),RuntimeLog: status.RuntimeLog,diff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.goindex 7521a7e6..b417607c 100644--- a/cli/beacon/cmd/endpoint_test.go+++ b/cli/beacon/cmd/endpoint_test.go@@ -1088,6 +1088,61 @@ func TestEndpointInventoryHooksJSONIncludesDefaultHookStatuses(t *testing.T) {}}+func TestRunEndpointInventoryWriteEventHonorsConfigContentOptIn(t *testing.T) {+ old := endpointOpts+ t.Cleanup(func() { endpointOpts = old })+ home := t.TempDir()+ t.Setenv("HOME", home)+ logPath := filepath.Join(t.TempDir(), "runtime.jsonl")+ writeTestFile(t, filepath.Join(home, ".cursor", "mcp.json"), `{"mcpServers":{"one":{"command":"npx","env":{"API_TOKEN":"secret"}}}}`)+ include := true+ cfg := endpointconfig.Default(true, logPath)+ cfg.Inventory = &endpointconfig.Inventory{+ Runtimes: []string{"cursor"},+ IncludeContents: &include,+ MaxContentBytes: 4096,+ }+ if _, err := endpointconfig.Save(cfg); err != nil {+ t.Fatal(err)+ }+ endpointOpts.userMode = true+ endpointOpts.jsonOutput = true+ endpointOpts.writeInventoryEvent = true+ endpointOpts.inventoryContents = false++ output, err := captureStdout(t, func() error {+ return runEndpointInventory(endpointInventoryCmd, nil)+ })+ if err != nil {+ t.Fatalf("runEndpointInventory returned error: %v", err)+ }+ var result inventoryResult+ if err := json.Unmarshal([]byte(output), &result); err != nil {+ t.Fatalf("inventory JSON did not decode: %v output=%s", err, output)+ }+ foundContent := false+ for _, config := range result.Configs {+ if config.Runtime == "cursor" && config.Exists && config.Content != nil {+ foundContent = true+ break+ }+ }+ if !foundContent {+ t.Fatalf("manual inventory JSON did not include opted-in content: %#v", result.Configs)+ }+ data, err := os.ReadFile(endpointinventory.LogPath(logPath, true))+ if err != nil {+ t.Fatal(err)+ }+ text := string(data)+ if !strings.Contains(text, `"content"`) || !strings.Contains(text, "mcpServers") {+ t.Fatalf("manual inventory snapshot log did not include opted-in content: %s", text)+ }+ if strings.Contains(text, "secret") {+ t.Fatalf("manual inventory snapshot log leaked secret content: %s", text)+ }+}+func TestCompletionAndDocsCommandsRegistered(t *testing.T) {for _, name := range []string{"completion", "docs"} {cmd, _, err := rootCmd.Find([]string{name})diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.goindex 5e2a4c07..e80f00d8 100644--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go@@ -675,6 +675,7 @@ func TestRedactSecretsAcrossFormats(t *testing.T) {{"json", `{"api_token": "ghp_x", "host": "h"}`, "ghp_x", 1},{"toml", "GITHUB_TOKEN = \"tk_x\"\nname = \"ok\"", "tk_x", 1},{"yaml", "password: hunter2\nuser: bob", "hunter2", 1},+ {"yaml block scalar", "api_token: |\n ghp_first\n ghp_second\nuser: bob", "ghp_second", 1},{"shell", "export AWS_SECRET_ACCESS_KEY=abc123\nexport PATH=/bin", "abc123", 1},{"none", `{"host": "example.com", "port": 8080}`, "", 0},}@@ -691,6 +692,24 @@ func TestRedactSecretsAcrossFormats(t *testing.T) {}}+func TestCaptureContentRedactsYAMLBlockScalarSecrets(t *testing.T) {+ content := captureContent([]byte("api_token: |\n ghp_first\n ghp_second\nuser: bob"), DefaultMaxContentBytes)+ if content == nil {+ t.Fatal("expected captured content")+ }+ if content.RedactedCount != 1 {+ t.Fatalf("redaction count = %d, want 1 (text=%q)", content.RedactedCount, content.Text)+ }+ for _, forbidden := range []string{"ghp_first", "ghp_second"} {+ if strings.Contains(content.Text, forbidden) {+ t.Fatalf("captured content leaked %q: %s", forbidden, content.Text)+ }+ }+ if !strings.Contains(content.Text, "user: bob") {+ t.Fatalf("captured content dropped non-secret YAML body: %s", content.Text)+ }+}+func fixedNow() time.Time {return time.Date(2026, 6, 5, 7, 0, 0, 0, time.UTC)}