Run pods have open egress for a moment at start on eventually-consistent NetworkPolicy enforcement

Open
#207 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
kubernetes, python
Domain
backend, security

Research direction

Start with the run pod setup, the admission policy that rejects init containers, and the existing run-isolation kind test that records startup_race; the issue does not name their file paths. Compare the proposed gate with both isolated and scanner policies, then run the kind leg and check that user code cannot reach the canary at t = 0. Done means enforcement is observed before user code starts, or the run fails as lost with a namespace detail when the bound expires.

Written by the indexing model from the issue text.

Description

queue: k8s compute (K)

Queue: K (process compute). Found by K-6's kind leg (#14).

Problem

On a CNI whose NetworkPolicy enforcement for a new pod is eventually consistent, a run pod has open egress for a short time after it starts, even with stac-higher-runs-default-deny in place.

Measured on kind v0.33.0 (kindnet / kube-network-policies), Kubernetes 1.34: a run pod connected to the node metadata address, the API server and an external host at t = 0; the first blocked connection came about 0.5 s after start; from then on all three stayed blocked. Connections opened inside the window are not re-checked. The AWS VPC CNI documents the same behaviour in its default standard enforcing mode (strict mode starts pods default-deny).

Untrusted run code therefore gets a sub-second window in which it can reach the metadata endpoint or exfiltrate, on any cluster that is not in a strict enforcing mode. The executor's fail-closed check (K-5) proves the policy object exists, not that it is enforced yet for this pod.

Options

  1. Require strict enforcement as a cluster prerequisite (chart README, R-11 live check). Documentation only; nothing proves it per run.
  2. A start gate in the run pod: a platform init container (the runtime image, by digest) that waits until a canary connection is observed blocked, then exits; user code starts only after that. Init containers share the pod's network identity, so once the gate sees the block the policy applies to the pod. If the block never comes within a bound, the run is lost with a detail naming the namespace: a per-run proof of enforcement, which also closes the "object exists, not enforced" residual (I-183). Needs: a canary that is reachable without a policy and blocked under both the isolated and scanner policies; the admission policy's no-init-containers rule relaxed to exactly this container; a kind test that user code observes no reachable target at its own t = 0.
  3. Both.

Notes

  • No migration expected.
  • The kind leg records the window (run-isolation observation, startup_race) and asserts only the settled state; a gate would let it assert t = 0 as well.
Dominant language
Python
Stars
0
Forks
2
Avg merge
8h 26m
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TechTraverse/stac-higher

All issues in TechTraverse/stac-higher

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.