Files
pages/internal/schutzaria/publication.go
T
Anya Tokugawa d5d21b7841
Build and publish container images / images (push) Successful in 9m34s
Release container images / release (push) Successful in 36s
Refactor architecture into eight components and consolidate reliability work
Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts.

Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation.

Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
2026-11-01 15:23:31 +09:00

53 lines
1.4 KiB
Go

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
}