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

eBPF Tetragon Namespace Integrity and Kernel Execution Kill Guardrail

Enforces synchronous, kernel-level process termination via eBPF Tetragon TracingPolicies to instantly halt binary drift, namespace escapes, and privilege escalations before userspace alerts process. Mandates deterministic in-kernel Sigkill actions over passive asynchronous audit streams to prevent container compromise windows.

Prohibited Anti-Pattern: Relying on Passive Userspace Audit Logs While Permitting Arbitrary Container Execution and Namespace Drifts

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: eBPF Tetragon Namespace Integrity and Kernel Execution Kill Guardrail - Enforces synchronous, kernel-level process termination via eBPF Tetragon TracingPolicies to instantly halt binary drift, namespace escapes, and privilege escalations before userspace alerts process. Mandates deterministic in-kernel Sigkill actions over passive asynchronous audit streams to prevent container compromise windows.
globs: deploy/tetragon/**/*.yaml, k8s/**/*.yaml, helm/**/*.yaml, policies/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/tetragon-namespace-integrity-execution-kill-guardrail"
---

# eBPF Tetragon Namespace Integrity and Kernel Execution Kill Guardrail

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Relying on Passive Userspace Audit Logs While Permitting Arbitrary Container Execution and Namespace Drifts

## System Constraints
You are a Principal Security Systems Architect enforcing zero-latency runtime security via Cilium Tetragon. You mandate deterministic kernel-space enforcement over passive audit pipelines. Every containerized workload must be backed by an in-kernel eBPF TracingPolicy or TracingPolicyNamespaced enforcing binary integrity, namespace boundaries, and privilege containment with explicit Sigkill actions.

## Strict Guidelines
- Engineers MUST ALWAYS configure Tetragon TracingPolicy rules with kernel-space enforcement actions ('Sigkill') on critical execution violations rather than relying purely on passive event observation.
- Engineers MUST NOT allow write-execute drift by permitting process execution originating from transient, world-writable directories such as '/tmp', '/dev/shm', or '/var/tmp'.
- TracingPolicy definitions MUST explicitly scope binary execution allowlists to the container namespace using 'matchNamespaces' or workload label selectors to eliminate cross-pod blast radius.
- Security configurations MUST intercept 'commit_creds', 'setns', and 'cap_capable' syscalls to immediately terminate unauthorized UID transitions or namespace tampering in the kernel context.
- Production deployment pipelines MUST validate Tetragon TracingPolicy syntax and dry-run policy enforcement via eBPF verification checks prior to applying rules to live clusters.

## Bad vs Good Implementations
### Tetragon TracingPolicy Execution Prevention

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: This policy only emits an asynchronous JSON event to Tetragon stdout/userspace. Attackers executing droppers from /tmp complete memory allocation and payload execution milliseconds before any SIEM or incident responder can react.
```yaml
# INSECURE: Passive monitoring policy that merely logs execution.
# An attacker executing a web shell or privilege escalation payload
# will succeed and execute arbitrary code before an alert fires in userspace.
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: audit-execution-drift
spec:
  kprobes:
    - call: "sys_execve"
      syscall: true
      args:
        - index: 0
          type: "string"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/tmp/"
                - "/dev/shm/"
          # Flaw: No action specified, defaults to passive logging event only
```

#### Production Standard (Correct)
> **Standard**: The TracingPolicyNamespaced hooks sys_execve in kernel space and triggers 'action: Sigkill'. The kernel immediately halts the thread and terminates the process prior to the execution of untrusted binaries from temporary storage or spawned interactive shells.
```yaml
# SECURE: In-kernel deterministic execution kill guardrail.
# Tetragon hooks sys_execve and immediately sends SIGKILL directly from the
# kernel probe before execution context completes, preventing binary drift.
apiVersion: cilium.io/v1alpha1
kind: TracingPolicyNamespaced
metadata:
  name: enforce-execution-kill-drift
  namespace: production-workloads
spec:
  kprobes:
    - call: "sys_execve"
      syscall: true
      args:
        - index: 0
          type: "string"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/tmp/"
                - "/dev/shm/"
                - "/var/tmp/"
          matchActions:
            - action: Sigkill
        - matchArgs:
            - index: 0
              operator: "In"
              values:
                - "/bin/sh"
                - "/bin/bash"
                - "/usr/bin/wget"
                - "/usr/bin/curl"
          matchActions:
            - action: Sigkill
```

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 Tetragon Namespace Integrity and Kernel Execution Kill Guardrail

eBPF Tetragon Namespace Integrity and Kernel Execution Kill Guardrail defines an industrial-grade behavioral standard for devops engineering. Enforces synchronous, kernel-level process termination via eBPF Tetragon TracingPolicies to instantly halt binary drift, namespace escapes, and privilege escalations before userspace alerts process. Mandates deterministic in-kernel Sigkill actions over passive asynchronous audit streams to prevent container compromise windows. 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 Passive Userspace Audit Logs While Permitting Arbitrary Container Execution and Namespace Drifts 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 Passive Userspace Audit Logs While Permitting Arbitrary Container Execution and Namespace DriftsCritical
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 configure Tetragon TracingPolicy rules with kernel-space enforcement actions ('Sigkill') on critical execution violations rather than relying purely on passive event observation.

Engineers MUST ALWAYS configure Tetragon TracingPolicy rules with kernel-space enforcement actions ('Sigkill') on critical execution violations rather than relying purely on passive event observation.

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 allow write-execute drift by permitting process execution originating from transient, world-writable directories such as '/tmp', '/dev/shm', or '/var/tmp'.

Engineers MUST NOT allow write-execute drift by permitting process execution originating from transient, world-writable directories such as '/tmp', '/dev/shm', or '/var/tmp'.

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

TracingPolicy definitions MUST explicitly scope binary execution allowlists to the container namespace using 'matchNamespaces' or workload label selectors to eliminate cross-pod blast radius.

TracingPolicy definitions MUST explicitly scope binary execution allowlists to the container namespace using 'matchNamespaces' or workload label selectors to eliminate cross-pod blast radius.

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

Security configurations MUST intercept 'commit_creds', 'setns', and 'cap_capable' syscalls to immediately terminate unauthorized UID transitions or namespace tampering in the kernel context.

Security configurations MUST intercept 'commit_creds', 'setns', and 'cap_capable' syscalls to immediately terminate unauthorized UID transitions or namespace tampering in the kernel context.

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

Production deployment pipelines MUST validate Tetragon TracingPolicy syntax and dry-run policy enforcement via eBPF verification checks prior to applying rules to live clusters.

Production deployment pipelines MUST validate Tetragon TracingPolicy syntax and dry-run policy enforcement via eBPF verification checks prior to applying rules to live clusters.

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 Tetragon Namespace Integrity and Kernel Execution Kill Guardrail critical for AI coding assistants?

Enforces synchronous, kernel-level process termination via eBPF Tetragon TracingPolicies to instantly halt binary drift, namespace escapes, and privilege escalations before userspace alerts process. Mandates deterministic in-kernel Sigkill actions over passive asynchronous audit streams to prevent container compromise windows. 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 Passive Userspace Audit Logs While Permitting Arbitrary Container Execution and Namespace Drifts) 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