IH-EXEC-005mediumExecution

Child process inherits ambient credentials

A skill that names an API key, token, or other secret-shaped variable and starts a child process with the parent environment gives that child every secret in the environment. A spread of process.env (including an MCP client `{ ...process.env, ...config.env }`), env: process.env, os.environ.copy(), **os.environ, and a spawn, exec, fork, or subprocess call that omits env all count. The secret may sit in the same file, or, for an explicit full-environment copy, in another file of the skill. An explicit env object or dict that lists the keys the child needs, and is not built from a full-environment copy, is quiet. A spawn in a file that names no secret is quiet. Files under test/ or fixtures/ are skipped. One finding is reported per file.

What does IH-EXEC-005 flag?

Flags a skill that names an API key or token and starts a child process that inherits the whole parent environment, so the child gets every secret, not just the one it needs.

  • A spread of process.env, env: process.env, os.environ.copy(), **os.environ or dict(os.environ) passed to a child process in a skill that names a secret.
  • A spawn, exec, fork or subprocess call that leaves env unset in a file that names a secret.
  • One finding per file.

Why it matters

Your shell environment often holds keys for many services. A helper process that inherits all of them can leak any of them, and a compromised dependency in that helper gets them for free.

Examples

Illustrative shapes with placeholders in angle brackets. They show what the rule looks at; they are not runnable and not taken from real malware.

Full environment copied to an MCP server
Flagged
spawn("node", ["srv.js"], { env: { ...process.env, ...config.env } })
Python copy of the environment
Flagged
subprocess.run(cmd, env=os.environ.copy())
Minimal environment
Not flagged
spawn("helper", { env: { PATH, HOME, API_KEY } })

Can IH-EXEC-005 fire on a safe skill?

  • A child that really needs most of the environment, such as a shell wrapper, still matches.
  • A secret name in a comment or help text can make an unrelated spawn in the same file count.

How do I fix an IH-EXEC-005 finding?

  • Build a minimal environment for the child: PATH, HOME and only the keys it needs, and pass that object as env.
  • Do not spread process.env, pass process.env itself, copy os.environ, or leave env unset.

CLI guidance: Build a minimal environment for the child: PATH, HOME, and only the keys that child needs. Pass that object as env.

How do I tune or allow IH-EXEC-005?

If you have checked that the child needs the full environment, exclude that file with ignoreGlobs or lower the rule with ruleOverrides for this project.

{
  "ignoreGlobs": [
    "docs/known-example.md"
  ],
  "ruleOverrides": {
    "IH-EXEC-005": {
      "severity": "low"
    }
  }
}

Every key is described in Configuration. To print this rule from the CLI, run ironheights rules show IH-EXEC-005.

What can IH-EXEC-005 miss?

  • Secrets loaded from files rather than the environment.
  • Children started through a library wrapper the rule does not recognize.
  • Files under test/, tests/, __tests__/, spec/ or fixtures/, which are skipped.

No finding means no rule matched. It is not proof of safety. Files larger than 1 MiB are skipped without being read; the verdict is then incomplete, not no findings, but the file is still not checked. See Limitations.

Scores and thresholds shown are the CLI defaults; your config can change them. List every rule from the terminal with ironheights rules list.

All 44 rules