ARTEX-English/program/classify.go
skilfoy bd502401a3 Add a fail-closed scope gate and an engagement desk.
A loaded range-scope file denies tool input that names anything outside it. Worker text that re-enters the planner is fenced. The desk keeps the engagement graph, run log, fireteam, and score, and only opens when a scope is installed.
2026-10-24 23:49:22 +00:00

49 lines
1.4 KiB
Go

package program
import "strings"
// Categories are property names, not procedures. A finding is labeled with
// one of them so a report says which property failed.
const (
CatSpoofing = "spoofing"
CatTampering = "tampering"
CatRepudiation = "repudiation"
CatInfoDisclosure = "info-disclosure"
CatDenialOfService = "denial-of-service"
CatPrivilege = "privilege-escalation"
CatAgentic = "agentic"
CatUnclassified = "unclassified"
)
// Classify maps a finding title and class name onto one category. It matches
// words already used by the operator. It does not invent a next step.
func Classify(name, vulnClass string) string {
text := strings.ToLower(name + " " + vulnClass)
switch {
case hasAny(text, "agent", "prompt", "tool-call", "mcp"):
return CatAgentic
case hasAny(text, "spoof", "authent", "session", "credential"):
return CatSpoofing
case hasAny(text, "tamper", "integrit"):
return CatTampering
case hasAny(text, "repudiat", "audit log", "logging"):
return CatRepudiation
case hasAny(text, "disclos", "expos", "leak"):
return CatInfoDisclosure
case hasAny(text, "denial", "availability"):
return CatDenialOfService
case hasAny(text, "privilege", "authoriz"):
return CatPrivilege
default:
return CatUnclassified
}
}
func hasAny(text string, words ...string) bool {
for _, word := range words {
if strings.Contains(text, word) {
return true
}
}
return false
}