Dynamic code execution guard
A deterministic Claude Code PreToolUse gate that masks comments and literals before detecting direct eval-style execution in JavaScript, TypeScript, Python, PHP, and Ruby source edits.
Runs on
Scope
$npx @youdede/toolkit add dynamic-code-execution-guard --target claude-code
What it does
Block new direct dynamic code execution primitives in supported source files.
When it fires
- implementation
- review
How it behaves
Recognize direct dynamic execution primitives in bounded proposed source content.
It does not execute or rewrite submitted source code.
It does not claim to detect indirect or reflective execution through custom wrappers.
It does not treat an inline suppression or comment as approval.
Configuration
targets/claude-code/dynamic-code-execution-guard.mjs
- Version
- 1.0.0
- Requires
- node
- Licence
- RiskThis automatic gate blocks new direct dynamic code execution primitives in supported source files; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyThe entrypoint handles one intercepted event to block new direct dynamic code execution primitives in supported source files without deferred work.
- Immediate
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Security