Zum Inhalt springen
Skillpedia
Agenten280k · #131

agent-security-hardening

Was er macht

Dieser Leitfaden zeigt, wie du KI-Systeme absicherst, die mit nicht vertrauenswürdigen Informationen arbeiten. Er hilft dir, Sicherheitsbarrieren aufzubauen, damit gefährliche Daten keine Probleme verursachen.

Wann du ihn nutzt

  • ✓Wenn du ein KI-System baust, das externe Daten empfängt.
  • ✓Wenn du Code prüfst, der Daten in Aktionen umwandelt.
  • ✓Wenn du verschiedene Nutzer oder Aufgaben innerhalb eines KI-Systems voneinander trennst.

Link zum Skill

https://github.com/affaan-m/ECC/blob/main/pi/core/skills/agent-security-hardening/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/affaan-m/ECC/blob/main/pi/core/skills/agent-security-hardening/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Wie stelle ich sicher, dass die KI keine gefährlichen Befehle ausführt, die auf den Daten basieren, die ich ihr gegeben habe?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Leitfaden empfiehlt, zu kartieren, wo nicht vertrauenswürdige Daten ins System gelangen, alles gründlich zu validieren, bevor eine Aktion ausgeführt wird, und den Zugriff auf Dateien und andere Systemteile zu begrenzen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Agent Security Hardening

Harden the boundaries where an agent turns untrusted data into filesystem, network, memory, or tool actions. Produce concrete controls and tests for the framework being reviewed; a checklist without enforcement evidence is incomplete.

Important

  • Treat model output, retrieved content, tool output, memory, and cross-agent messages as untrusted input.
  • Default external integrations to read-only and grant each write capability separately.
  • Validate at the action boundary even when an upstream prompt or schema already validated the value.
  • Fail closed before a side effect when identity, destination, ownership, or containment cannot be proven.
  • Before a delete, publish, credential rotation, or other irreversible action, the real tool entry point must authorize the authenticated principal for that exact operation and resource scope, then require explicit confirmation or a valid scoped pre-approval. Missing or invalid evidence blocks the action.
  • Use hard bounds defined by the governing requirement and stricter values verified from deployment configuration. When neither defines a value, mark it as a required decision and test that the implementation rejects an unbounded configuration; do not invent a plausible value.

When to Activate

  • Building an autonomous agent, tool gateway, memory service, or agent-to-agent protocol
  • Reviewing code that maps model output into commands, paths, URLs, credentials, or API mutations
  • Isolating tenants, projects, sessions, or workspaces in a long-running agent process
  • Hardening temporary files, logs, tool responses, or external-content ingestion

Hardening Workflow

1. Map Trust Boundaries

List every boundary as source -> parser -> validator -> side effect. Include direct user input, model output, retrieved documents, memory, environment variables, tool results, and messages from other agents.

For each side effect, record:

  • the identity and scope authorizing it;
  • the exact validator that runs immediately before it;
  • the maximum input and output size;
  • the audit evidence produced;
  • the recovery path if the operation is interrupted.

This step is complete when every write, command, network mutation, and credential use has one named authorization boundary.

2. Validate Identifiers, Environment Values, and URLs

Use an allowlist for identifiers that become filenames, keys, selectors, or command arguments. Agent IDs have the issue-defined hard maximum of 64 characters; deployment configuration may choose a stricter positive limit but cannot raise that boundary:

import re

SAFE_AGENT_ID_CHARS = re.compile(r"^[A-Za-z0-9_][A-Za-z0-9_-]*$")
HARD_MAX_AGENT_ID_LENGTH = 64

def require_agent_id(value: object, *, max_length: int) -> str:
    if (
        isinstance(max_length, bool)
        or not isinstance(max_length, int)
        or not 1 <= max_length <= HARD_MAX_AGENT_ID_LENGTH
    ):
        raise RuntimeError("configured agent ID limit must be between 1 and 64")
    if (
        not isinstance(value, str)
        or len(value) > max_length
        or not SAFE_AGENT_ID_CHARS.fullmatch(value)
    ):
        raise ValueError("invalid agent identifier")
    return value

When an identifier becomes a CLI argument, pass it through an argv API and place it after the command's end-of-options marker where supported. Character validation is not a substitute for argument separation.

Reject missing and whitespace-only environment values before constructing a client:

def require_env(name: str, environ: dict[str, str]) -> str:
    value = environ.get(name)
    if value is None or not value.strip():
        raise RuntimeError(f"{name} is required")
    return value

Parse URLs, allow only schemes required by the deployment, require a host, reject embedded credentials, and block private-network destinations when the URL is attacker-controlled. For every outbound connection and redirect hop, pin the connection to a validated public address or verify the connected peer address at connection time so DNS rebinding cannot cross the boundary. A credential-bearing request must use HTTPS with certificate verification before credentials are attached. Disable automatic cross-origin credential forwarding; when the scheme or origin changes, strip the credentials and reauthorize the new destination or reject the redirect. Re-run destination, connected-address, and transport validation on every hop.

…

Häufige Fragen

Was bedeutet „Behandle Modell-Ausgaben als nicht vertrauenswürdige Eingaben“?

Das heißt, alles, was die KI erzeugt, muss geprüft werden, bevor du es verwendest, auch wenn es harmlos aussieht. Es könnte etwas Unerwartetes oder Gefährliches enthalten.

Warum ist es wichtig, auch bereits geprüfte Daten erneut zu validieren?

Weil Validierung bei jedem Schritt, besonders vor einer Aktion mit Nebenwirkungen (etwa dem Löschen von etwas), sicherstellt, dass nichts Gefährliches unbemerkt durchrutscht.

Was ist „Fail Closed“?

Das ist eine Sicherheitsregel: Im Zweifel wird der Zugriff oder die Aktion blockiert. Wenn sich nicht beweisen lässt, dass etwas sicher ist, wird es lieber nicht erlaubt.

Details

Originalbeschreibung des Autors

Security hardening guidance for AI agent frameworks that process untrusted content, invoke tools, write workspace files, manage runtime identifiers, or handle credentials. Use when building or reviewing an agent runtime, autonomous worker, tool gateway, memory service, or multi-tenant agent deployment. Do not use for general web application security or offensive testing.

repo: affaan-m/ECC

Beliebtheit

GitHub-Sterne
280k
Platz im Ranking
#131
Lizenz
MIT
Aktualisiert
15.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills