Skip to content

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

Fix windows embed path

Justin D'Souza8142cd5554b7
diff --git a/cli/beacon/internal/endpoint/detect/detect.go b/cli/beacon/internal/endpoint/detect/detect.go
index 4c03be41..f0c62d5f 100644
--- a/cli/beacon/internal/endpoint/detect/detect.go
+++ b/cli/beacon/internal/endpoint/detect/detect.go
@@ -12,6 +12,7 @@ import (
"fmt"
"io/fs"
"os"
+ "path"
"path/filepath"
"sort"
"strings"
@@ -70,7 +71,7 @@ func Baseline() ([]*threatrules.Rule, error) {
rules := make([]*threatrules.Rule, 0, len(names))
seen := map[string]bool{}
for _, name := range names {
- data, err := baselineFS.ReadFile(filepath.Join("baseline", name))
+ data, err := baselineFS.ReadFile(baselineRulePath(name))
if err != nil {
return nil, err
}
@@ -90,6 +91,10 @@ func Baseline() ([]*threatrules.Rule, error) {
return rules, nil
}
+func baselineRulePath(name string) string {
+ return path.Join("baseline", name)
+}
+
// LoadActive resolves the active rule set:
//
// - if rulesDir is non-empty, load only from that directory (explicit override);
diff --git a/cli/beacon/internal/endpoint/detect/detect_test.go b/cli/beacon/internal/endpoint/detect/detect_test.go
index ff179c52..240760f2 100644
--- a/cli/beacon/internal/endpoint/detect/detect_test.go
+++ b/cli/beacon/internal/endpoint/detect/detect_test.go
@@ -25,6 +25,13 @@ func TestBaselineValid(t *testing.T) {
}
}
+func TestBaselineRulePathUsesEmbedFSSeparator(t *testing.T) {
+ got := baselineRulePath("example.rule.yaml")
+ if got != "baseline/example.rule.yaml" {
+ t.Fatalf("embedded FS paths must use forward slashes, got %q", got)
+ }
+}
+
const aRule = `
id: %ID%
version: 1