Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Merge branch 'claude/asymptote-labs-guide-6e8rfw' into claude/windows-secret-files-6e8rfw

Claudeb5577639147b
diff --cc cli/beacon/internal/endpoint/config/config_test.go
index 8c943484,9be757b7..5f624cdd
--- a/cli/beacon/internal/endpoint/config/config_test.go
+++ b/cli/beacon/internal/endpoint/config/config_test.go
@@@ -341,31 -341,27 +341,56 @@@ func TestValidateDestinationsRejectsBad
}
}
+// Callers that edit config.json's raw JSON (the auto-update mode) write it as Save would: private
+// when it holds a credential or already was, readable otherwise. On Windows the private case is the
+// SYSTEM/Administrators-only DACL (sysacl.WriteSecretFile), which TestWriteSecretFile covers there.
+func TestRewriteSystemConfigKeepsCredentialsPrivate(t *testing.T) {
+ testenv.RequirePOSIXFileModes(t)
+ dir := t.TempDir()
+ for _, tc := range []struct {
+ name, body string
+ wasPrivate bool
+ want os.FileMode
+ }{
+ {"hec token", `{"destinations":{"splunk_hec":{"endpoint":"https://splunk.example","token":"t"}}}`, false, 0600},
+ {"already private", `{"auto_update":{"mode":"off"}}`, true, 0600},
+ {"nothing secret", `{"auto_update":{"mode":"off"}}`, false, 0644},
+ } {
+ path := filepath.Join(dir, strings.ReplaceAll(tc.name, " ", "-")+".json")
+ if err := RewriteSystemConfig(path, []byte(tc.body), tc.wasPrivate); err != nil {
+ t.Fatalf("%s: %v", tc.name, err)
+ }
+ info, err := os.Stat(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := info.Mode().Perm(); got != tc.want {
+ t.Errorf("%s: permissions = %o, want %o", tc.name, got, tc.want)
+ }
+ }
+}
++
+ // A package removal or cleanup can take the headers file while config.json still names them. Load
+ // says so instead of handing back a forward that silently sends without credentials.
+ func TestLoadReportsMissingOTLPForwardHeaders(t *testing.T) {
+ home := t.TempDir()
+ testenv.SetHome(t, home)
+ cfg := Default(true, filepath.Join(home, "logs", "runtime.jsonl"))
+ cfg.Destinations = &Destinations{OTLPForward: &OTLPForward{Endpoint: "otel.example:4317", Headers: map[string]string{"authorization": "Bearer x"}}}
+ if _, err := Save(cfg); err != nil {
+ t.Fatal(err)
+ }
+ if loaded, err := Load(true); err != nil || loaded.Destinations.OTLPForward.HeadersMissing {
+ t.Fatalf("HeadersMissing with the file present: %v", err)
+ }
+ if err := os.Remove(OTLPForwardSecretsPath(true)); err != nil {
+ t.Fatal(err)
+ }
+ loaded, err := Load(true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if f := loaded.Destinations.OTLPForward; !f.HeadersMissing || f.Headers != nil || strings.Join(f.HeaderNames, ",") != "authorization" {
+ t.Fatalf("forward without its headers file = %#v", f)
+ }
+ }