AST rules & capabilities
This is how Cordon sees through obfuscation, and how you extend it.
┌───────────┐ most files stop here │ literal │ exact bytes ├───────────┤ │ regex │ safe subset ├───────────┤ │ structural│ parsed manifests/config ├───────────┤ │ ast │ RESOLVED calls — sees through aliases, folding, getattr ├───────────┤ │ graph │ over the dependency graph ├───────────┤ │ composite │ boolean over the above, within a scope └───────────┘
SOURCE RESOLVES TO ────── ────────── os.system("id") os.system f = os.system ; f("id") os.system (bound name) getattr(os, "sys"+"tem")("id") os.system (folded + getattr) const { exec } = require('child_process') child_process.exec import { exec as e } from 'child_process' child_process.exec (renamed import)
┌─────────────────────────────────────────────┐
kind: ast │ callee = child_process.exec (or spawn…) │
│ argument is CONSTRUCTED (not a literal) │
└─────────────────────────────────────────────┘
│ Python │ JS / TS
▼ ▼
stdlib `ast` Cordon's own parser
(always on) (always on)JS/TS calls are resolved by Cordon's own front end -- real scopes, aliases through require, every import form, createRequire, dynamic import(), TypeScript `import =`, computed members and bundler calls -- in every install. No parser written elsewhere ever reads a scanned file.
CAP.*.DECODE ┐ CAP.*.EXECUTE ├─▶ composite: "decode → execute within N lines" = second-stage loader CAP.*.SPAWN ┘
cordon-scanner rules test # every rule with an inline sample must still fire