What does IH-CRED-004 flag?
Flags a skill that writes a token, key or session file without owner-only permissions, so other users and processes on the machine can read it.
- Opening a token, key or session path for writing without mode 600 or umask 077.
- Saving through a temp file and rename, which resets an earlier chmod 600.
- Backup archives of ~/.openclaw or credentials made without umask 077.
Why it matters
With the usual umask 022 a new file is created readable by everyone. On a shared machine, or with any other local process, that is enough to copy the token. Backups of ~/.openclaw made the same way leak every credential at once.
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.
Can IH-CRED-004 fire on a safe skill?
- A file named like a token that holds no secret.
- Code that sets permissions in a helper function the rule does not follow.
How do I fix an IH-CRED-004 finding?
- Create the file owner-only: os.open with 0o600, writeFile with { mode: 0o600 }, plus chmod for files that already exist.
- Use umask 077 in shell scripts and mkstemp before an atomic rename.
CLI guidance: Create the file owner-only: os.open(path, O_CREAT|O_WRONLY, 0o600) or writeFile(path, data, { mode: 0o600 }) plus chmod for existing files, umask 077 in shell scripts, and mkstemp before an atomic rename.
How do I tune or allow IH-CRED-004?
If permissions are set elsewhere, exclude that file with ignoreGlobs or lower the rule with ruleOverrides.
Every key is described in Configuration. To print this rule from the CLI, run ironheights rules show IH-CRED-004.
What can IH-CRED-004 miss?
- Permissions changed later by another tool.
- Windows ACLs, which this rule does not model.
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.
Related rules
ironheights rules list.