()
| 42 | } |
| 43 | |
| 44 | export 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 | } |
nothing calls this directly
no test coverage detected