package schutzaria import "strings" type LocalityPolicy struct { Kind string `json:"kind"` UUID string `json:"uuid"` Policy string `json:"policy"` } // EvaluateLocalityPublication combines a Domain-first chain's ceilings and // intent. Neither result is an anonymous-read grant or a reviewer approval. // The caller loads/validates topology and binds immutable revisions separately. func EvaluateLocalityPublication(chain []LocalityPolicy) (allows, published bool) { allows = true for i, p := range chain { if i == 0 && p.Policy == "inherit" { return false, false } switch p.Policy { case "authenticated_acl": allows = false case "public": if i > 0 { published = true } case "inherit": default: return false, false } } return allows, allows && published } // PublicSemanticPath is a namespace eligibility check, never permission to // publish content. User-space publication has its own authenticated policy path. func PublicSemanticPath(path string) bool { if !strings.HasPrefix(path, "/") || strings.ContainsAny(path, "\\\x00\r\n") || strings.Contains(path, "//") { return false } for _, segment := range strings.Split(path, "/") { if segment == "." || segment == ".." { return false } } first := strings.Split(strings.TrimPrefix(path, "/"), "/")[0] switch first { case "_", "-", ":", "o", "r", "v", "l", "e", "s", "u", "g", "static", "health", "new": return false } return true }