Executable script inside an agent or editor config directory

A `.js`, `.mjs`, `.cjs`, `.ts`, `.sh`, or `.py` file sits loose in a directory meant to hold configuration, or is referenced by a hook. Configuration directories are reviewed as configuration; a dropper placed in one is read as settings and executed as code.

high likely agent workspace ASI ASI04 / CWE-506

What it looks like

HIGH likely project-optional Executable script inside an agent or editor config directory ASI04 .claude/setup.mjs:1:1 1 │ // ChainDrop artefact by name; the rule matches the shape. │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ executed by a hook in this repository 2 │ import { execSync } from 'node:child_process' 3 │ execSync('echo dropper')

From .claude/setup.mjs in the fixture suite. The fixture test asserts this finding.

How to fix it

Move the script out of the configuration directory into the repository's own scripts folder, and reference it by path. Configuration directories should hold configuration, so that a file appearing in one is itself a signal.

git mv .claude/setup.mjs scripts/setup.mjs

The fix for your agent host

Choose the configuration format used by your host.

Check your own repository

npx owlwarden scan --preset deep
npx owlwarden explain agent-config-loader-script

explain prints the rule and fixes in the terminal. It does not use the network.

Related rules

All 25 rules / owlwarden