This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: ebpf-tetragon-namespace-execution-lineage-gate

eBPF Cilium Tetragon Runtime Namespace Execution Lineage Gate

Enforces synchronous in-kernel blocking via Cilium Tetragon TracingPolicies on sys_execve/sys_execveat to prevent container breakouts and unauthorized shell spawns. Requires strict process lineage validation and deterministic SIGKILL enforcement before syscall return, rejecting asynchronous user-space post-facto audit logging.

Prohibited Anti-Pattern: Relying on Asynchronous User-Space Auditing or Permissive Non-Enforcing TracingPolicies for Container Executions

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: eBPF Cilium Tetragon Runtime Namespace Execution Lineage Gate - Enforces synchronous in-kernel blocking via Cilium Tetragon TracingPolicies on sys_execve/sys_execveat to prevent container breakouts and unauthorized shell spawns. Requires strict process lineage validation and deterministic SIGKILL enforcement before syscall return, rejecting asynchronous user-space post-facto audit logging.
globs: deploy/tetragon/**/*.yaml, infra/k8s/security/**/*.yaml, charts/**/tetragon-policies/*.yaml, policies/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/ebpf-tetragon-namespace-execution-lineage-gate"
---

# eBPF Cilium Tetragon Runtime Namespace Execution Lineage Gate

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Relying on Asynchronous User-Space Auditing or Permissive Non-Enforcing TracingPolicies for Container Executions

## System Constraints
You are a Principal Systems & Runtime Security Engineer specializing in Linux kernel internals and eBPF observability. You mandate strict, synchronous execution containment using Cilium Tetragon TracingPolicies. You reject passive observability, post-execve alerting, and unconstrained process hierarchies across container namespaces. Ensure all execution gates terminate malicious lineages directly in the kernel via Sigkill before execve completion.

## Strict Guidelines
- Engineers MUST ALWAYS declare 'matchActions' with 'action: Sigkill' on Tetragon TracingPolicy definitions monitoring sys_enter_execve or __x64_sys_execve when an unauthorized binary is detected.
- Engineers MUST NOT rely on passive user-space agents (e.g., standard auditd or read-only Tetragon events) for zero-trust runtime execution barriers, as asynchronous alerts suffer from race conditions against short-lived malicious payloads.
- TracingPolicies MUST explicitly scope enforcement to target namespaces using 'podSelector' or 'matchNamespace' fields to avoid uncoordinated node-level disruption.
- Policies MUST validate parent process lineage using 'matchArgs' and 'matchBinaries' across binary execution trees, ensuring utilities like bash, sh, curl, or nc cannot be invoked from non-orchestration ancestors.
- Security manifests MUST define 'scope: Namespaced' or 'TracingPolicyNamespaced' whenever application-tier guardrails are applied, reserving cluster-wide 'TracingPolicy' for core Kubernetes runtime components.

## Bad vs Good Implementations
### Tetragon TracingPolicy: Non-Enforcing User-Space Auditing vs Kernel-Level Sigkill Execution Gate

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: This policy only streams audit logs to tetragon.log via user space. The execve syscall completes successfully, allowing unauthorized binaries or breakout exploits to run to completion before an external incident response tool can act.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: audit-shell-execution
spec:
  kprobes:
    - call: "sys_execve"
      syscall: true
      args:
        - index: 0
          type: "string"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/bin/sh"
                - "/bin/bash"
          # Flaw: No matchAction defined; events are only piped asynchronously to tetragon.log.
          # The shell executes, completes the payload, and evades mitigation before user-space responds.
```

#### Production Standard (Correct)
> **Standard**: This policy targets the specific namespace and pod selector, intercepting sys_execve in-kernel via eBPF kprobes. If an unauthorized binary is invoked, Tetragon dispatches a Sigkill synchronously, blocking the syscall completion and terminating the offending thread instantly.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicyNamespaced
metadata:
  name: block-unauthorized-exec-lineage
  namespace: production-workloads
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/part-of: payment-gateway
  kprobes:
    - call: "sys_execve"
      syscall: true
      args:
        - index: 0
          type: "string"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/bin/sh"
                - "/bin/bash"
                - "/usr/bin/nc"
                - "/usr/bin/curl"
          matchActions:
            - action: Sigkill
              argError: 0
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: eBPF Cilium Tetragon Runtime Namespace Execution Lineage Gate

eBPF Cilium Tetragon Runtime Namespace Execution Lineage Gate defines an industrial-grade behavioral standard for devops engineering. Enforces synchronous in-kernel blocking via Cilium Tetragon TracingPolicies on sys_execve/sys_execveat to prevent container breakouts and unauthorized shell spawns. Requires strict process lineage validation and deterministic SIGKILL enforcement before syscall return, rejecting asynchronous user-space post-facto audit logging. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Relying on Asynchronous User-Space Auditing or Permissive Non-Enforcing TracingPolicies for Container Executions Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftRelying on Asynchronous User-Space Auditing or Permissive Non-Enforcing TracingPolicies for Container ExecutionsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS declare 'matchActions' with 'action

Engineers MUST ALWAYS declare 'matchActions' with 'action: Sigkill' on Tetragon TracingPolicy definitions monitoring sys_enter_execve or __x64_sys_execve when an unauthorized binary is detected.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT rely on passive user-space agents (e.g., standard auditd or read-only Tetragon events) for zero-trust runtime execution barriers, as asynchronous alerts suffer from race conditions against short-lived malicious payloads.

Engineers MUST NOT rely on passive user-space agents (e.g., standard auditd or read-only Tetragon events) for zero-trust runtime execution barriers, as asynchronous alerts suffer from race conditions against short-lived malicious payloads.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

TracingPolicies MUST explicitly scope enforcement to target namespaces using 'podSelector' or 'matchNamespace' fields to avoid uncoordinated node-level disruption.

TracingPolicies MUST explicitly scope enforcement to target namespaces using 'podSelector' or 'matchNamespace' fields to avoid uncoordinated node-level disruption.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Policies MUST validate parent process lineage using 'matchArgs' and 'matchBinaries' across binary execution trees, ensuring utilities like bash, sh, curl, or nc cannot be invoked from non-orchestration ancestors.

Policies MUST validate parent process lineage using 'matchArgs' and 'matchBinaries' across binary execution trees, ensuring utilities like bash, sh, curl, or nc cannot be invoked from non-orchestration ancestors.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Security manifests MUST define 'scope

Security manifests MUST define 'scope: Namespaced' or 'TracingPolicyNamespaced' whenever application-tier guardrails are applied, reserving cluster-wide 'TracingPolicy' for core Kubernetes runtime components.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is eBPF Cilium Tetragon Runtime Namespace Execution Lineage Gate critical for AI coding assistants?

Enforces synchronous in-kernel blocking via Cilium Tetragon TracingPolicies on sys_execve/sys_execveat to prevent container breakouts and unauthorized shell spawns. Requires strict process lineage validation and deterministic SIGKILL enforcement before syscall return, rejecting asynchronous user-space post-facto audit logging. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Relying on Asynchronous User-Space Auditing or Permissive Non-Enforcing TracingPolicies for Container Executions) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

eBPF