Agent skill
security/terminal
Terminal Security security skill
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/security/securityterminal
SKILL.md
Terminal Security
Terminal emulators interpret escape sequences that can be weaponized. LLM responses are untrusted.
ikigai Application
ANSI escape injection:
- LLM responses may contain malicious escape sequences
- Attackers can: change terminal title, redefine keys, write to arbitrary screen positions
- Some terminals vulnerable to escape sequences that execute commands
Sanitization strategy:
- Strip or escape control characters (0x00-0x1F, 0x7F) except safe ones
- Allowlist:
\n,\r,\tfor formatting - Escape or strip:
\x1b(ESC),\x9b(CSI) - Consider: pass through only after validation
Safe display patterns:
// Filter control chars before display
for (size_t i = 0; i < len; i++) {
if (data[i] < 0x20 && data[i] != '\n' && data[i] != '\t') {
continue; // Skip control char
}
output_char(data[i]);
}
Raw mode considerations:
- Restore terminal state on exit (even on crash)
- Handle SIGINT/SIGTERM to cleanup
- Don't leak raw mode to child processes
Review red flags: Unsanitized LLM output to terminal, missing escape filtering, no terminal cleanup on error paths.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?