Files
core/solutions/engine/security_test.go
T
terminarandClaude Opus 5.5 2481a0dd27 solutions: Solutions Guide engine (catalog, rules, wizard state, native config, knowledge index, CLI)
New nested module yetano.dev/yetano/core/solutions: loads the catalog
in assets/solutions on top of the Big Picture, evaluates questions and
conditions, resolves packages/modules/capabilities, generates native
configuration from typed fragments with per-value origins, and builds
architecture graph, plan, lock file and handbook. Knowledge index with
yetano: references, search and lint (incl. manual sections). CLI with
yet's conventions (solution, task, knowledge, open), standalone as
yetano-solutions. No execution, no network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 08:42:58 +01:00

34 lines
1.1 KiB
Go

package engine
import (
"os/exec"
"strings"
"testing"
)
// SEC-02: the catalog, the engine and the knowledge index never run a
// program or open a network connection; the CLI may (doctor checks).
// core/secretref links os/exec for resolving secret:// through yaseva;
// the engine only uses its Validate, so os/exec is checked on the
// packages' own imports, network packages on all dependencies.
func TestNoExecOrNetwork(t *testing.T) {
for _, pkg := range []string{"../catalog", "../engine", "../knowledge", "../ref"} {
own, err := exec.Command("go", "list", "-f", "{{join .Imports \" \"}}", pkg).Output()
if err != nil {
t.Skip("go list not available")
}
for _, dep := range strings.Fields(string(own)) {
if dep == "os/exec" || dep == "syscall" || dep == "plugin" || dep == "unsafe" {
t.Errorf("%s imports %s", pkg, dep)
}
}
all, _ := exec.Command("go", "list", "-deps", "-f", "{{.ImportPath}}", pkg).Output()
for _, dep := range strings.Fields(string(all)) {
switch dep {
case "net/http", "net/rpc", "net/smtp", "crypto/tls":
t.Errorf("%s depends on %s", pkg, dep)
}
}
}
}