MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / is_nested

Method is_nested

src/docker/mod.rs:207–213  ·  view source on GitHub ↗

Returns true when TSK is running inside a TSK container with proxy env vars pointing to `tsk-proxy`. In this case, proxy and network isolation are handled by the outer container's Docker environment, so we skip them for nested containers. We require proxy env vars to reference `tsk-proxy` to avoid silently granting unrestricted internet access when `TSK_CONTAINER=1` is set without a properly conf

(&self)

Source from the content-addressed store, hash-verified

205 /// granting unrestricted internet access when `TSK_CONTAINER=1` is set
206 /// without a properly configured proxy.
207 fn is_nested(&self) -> bool {
208 // In tests, always use the normal proxy/network path so mocks work correctly
209 if cfg!(test) {
210 return false;
211 }
212 std::env::var("TSK_CONTAINER").is_ok() && Self::has_tsk_proxy_env()
213 }
214
215 /// Returns true if at least one proxy env var references the `tsk-proxy` host.
216 fn has_tsk_proxy_env() -> bool {

Callers 3

build_proxy_env_varsMethod · 0.80
run_task_containerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected