MCPcopy Create free account
hub / github.com/Noumena-Network/code / checkProtectedNamespace

Function checkProtectedNamespace

src/utils/protectedNamespace.js:44–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44export function checkProtectedNamespace() {
45 // Homespace is explicitly treated as unprotected.
46 if (isEnvTruthy(process.env.COO_RUNNING_ON_HOMESPACE)) {
47 return false
48 }
49
50 const cooSignalPresent = hasAnyCooSignal()
51 const k8sSignal = getKubernetesNamespaceSignal()
52 const hasAnySignals = cooSignalPresent || k8sSignal.hasSignal
53
54 // No COO/Kubernetes signals at all => local/laptop style env (unprotected).
55 if (!hasAnySignals) {
56 return false
57 }
58
59 const namespace = getConfiguredNamespace() ?? k8sSignal.namespace
60 if (
61 namespace !== null &&
62 OPEN_NAMESPACE_ALLOWLIST.has(namespace.toLowerCase())
63 ) {
64 return false
65 }
66
67 // Conservative fallback for all other signaled environments.
68 return true
69}

Callers

nothing calls this directly

Calls 5

hasAnyCooSignalFunction · 0.85
getConfiguredNamespaceFunction · 0.85
isEnvTruthyFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected