Agent skill
security/filesystem
Filesystem Security security skill
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/filesystem-mgreenly-ikigai-2
SKILL.md
Filesystem Security
File operations have race conditions, symlink attacks, and path traversal risks.
ikigai Application
Path traversal:
- Reject paths containing
..before canonicalization - Use
realpath()and verify result is under allowed directory - Never concatenate user input directly into paths
TOCTOU (Time-of-Check to Time-of-Use):
// BAD: Race between check and use
if (access(path, R_OK) == 0) { fd = open(path, O_RDONLY); }
// GOOD: Open first, then check
fd = open(path, O_RDONLY);
if (fd >= 0) { /* use fd */ }
Symlink attacks:
- Use
O_NOFOLLOWwhen opening files in shared directories lstat()to check for symlinks before operations- Create temp files with
mkstemp(), nevermktemp()
Permissions:
- Config files:
0600(owner read/write only) - Directories:
0700 - Check permissions before reading sensitive files
- Set umask appropriately:
umask(077)
Review red flags: access() before open(), path concatenation, missing O_NOFOLLOW, world-readable configs.
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?