The most common contribution is a new detection rule. Everything is pure stdlib and needs no network.
-
Add the rule to
RULESinscanner/rules.py, next to related rules:Rule("CRED-AWS", "credentials", "high", HOME + r"/\.aws\b|\.aws/credentials|aws_secret_access_key", "Reads AWS credentials, which have nothing to do with most skills."),
idis unique and upper-case, prefixed by its category (CRED-,EXFIL-,DL-, ...).categoryshould be one that has an entry inJAIL_NOTES(add one if you need a new category).severityishigh(verdict RISKY),medium(REVIEW) orlow(informational).- The pattern is a regex applied to one line; pass
multiline=Trueto match across the whole file, orfiles=(...)to limit it to certain extensions or names. Case-insensitive by default. whyis one sentence a non-expert can act on.- Keep
rules.pyboring: no network, no imports beyondre.
-
Add a sample skill under
tests/skills/<name>/with aSKILL.md(and any scripts) that triggers the rule. Name itmalicious-*,borderline-*orclean-*. Defang malicious samples: use reserved.examplehosts and wire nothing to run. If the rule fits an existing sample, extend that one instead. -
Add its entry to
tests/expected.json:"malicious-dns-hijack": {"verdict": "RISKY", "must_have_rules": ["YOUR-RULE-ID"]}
All keys other than
verdictare optional:must_have_rules(rule IDs that must fire),must_not(severities that must be absent) andmust_contact(hosts the scan must report contacting). -
Regenerate the rule catalog:
python3 scripts/gen_rules_doc.py(updatesdocs/RULES.md, which the suite checks is up to date). -
Run the suite:
python3 tests/run_tests.py. It must exit 0. Existing clean samples must stay SAFE, so check that your pattern does not cause false positives.
scripts/verify.sh runs the same suite plus the SkillJail checks, if skilljail is installed.