aeppo 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. aeppo-0.8.0/LICENSE +21 -0
  2. aeppo-0.8.0/PKG-INFO +354 -0
  3. aeppo-0.8.0/README.md +329 -0
  4. aeppo-0.8.0/aeppo/__init__.py +1 -0
  5. aeppo-0.8.0/aeppo/cli.py +139 -0
  6. aeppo-0.8.0/aeppo/config.py +189 -0
  7. aeppo-0.8.0/aeppo/findings.py +86 -0
  8. aeppo-0.8.0/aeppo/lexer.py +218 -0
  9. aeppo-0.8.0/aeppo/lockfiles.py +315 -0
  10. aeppo-0.8.0/aeppo/osv.py +263 -0
  11. aeppo-0.8.0/aeppo/report.py +83 -0
  12. aeppo-0.8.0/aeppo/rules_actions.py +102 -0
  13. aeppo-0.8.0/aeppo/rules_autoexec.py +197 -0
  14. aeppo-0.8.0/aeppo/rules_code.py +460 -0
  15. aeppo-0.8.0/aeppo/rules_deps.py +57 -0
  16. aeppo-0.8.0/aeppo/rules_js.py +73 -0
  17. aeppo-0.8.0/aeppo/rules_python.py +212 -0
  18. aeppo-0.8.0/aeppo/rules_secrets.py +62 -0
  19. aeppo-0.8.0/aeppo/rules_shell.py +171 -0
  20. aeppo-0.8.0/aeppo/rules_vulns.py +130 -0
  21. aeppo-0.8.0/aeppo/scanner.py +225 -0
  22. aeppo-0.8.0/aeppo.egg-info/PKG-INFO +354 -0
  23. aeppo-0.8.0/aeppo.egg-info/SOURCES.txt +37 -0
  24. aeppo-0.8.0/aeppo.egg-info/dependency_links.txt +1 -0
  25. aeppo-0.8.0/aeppo.egg-info/entry_points.txt +2 -0
  26. aeppo-0.8.0/aeppo.egg-info/top_level.txt +1 -0
  27. aeppo-0.8.0/pyproject.toml +40 -0
  28. aeppo-0.8.0/setup.cfg +4 -0
  29. aeppo-0.8.0/tests/test_action.py +88 -0
  30. aeppo-0.8.0/tests/test_backdoor_patterns.py +167 -0
  31. aeppo-0.8.0/tests/test_cli.py +150 -0
  32. aeppo-0.8.0/tests/test_code_rules.py +142 -0
  33. aeppo-0.8.0/tests/test_config.py +205 -0
  34. aeppo-0.8.0/tests/test_corpus.py +109 -0
  35. aeppo-0.8.0/tests/test_coverage_v031.py +131 -0
  36. aeppo-0.8.0/tests/test_osv.py +261 -0
  37. aeppo-0.8.0/tests/test_rules.py +216 -0
  38. aeppo-0.8.0/tests/test_scanner.py +185 -0
  39. aeppo-0.8.0/tests/test_secrets.py +70 -0
aeppo-0.8.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 emanuellzoe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
aeppo-0.8.0/PKG-INFO ADDED
@@ -0,0 +1,354 @@
1
+ Metadata-Version: 2.4
2
+ Name: aeppo
3
+ Version: 0.8.0
4
+ Summary: Local static scanner for risky source patterns and exposed secrets
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/emanuellzoe/aeppo
7
+ Project-URL: Changelog, https://github.com/emanuellzoe/aeppo/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/emanuellzoe/aeppo/issues
9
+ Keywords: security,static-analysis,sast,secrets,supply-chain,backdoor,github-actions
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Security
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Classifier: Environment :: Console
20
+ Classifier: Intended Audience :: Developers
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Dynamic: license-file
25
+
26
+ # aeppo
27
+
28
+ `aeppo` is a local static scanner that flags selected risky code patterns and potentially exposed credentials in Python, JavaScript, TypeScript, Go, Rust, Java, Kotlin, PHP and Ruby source files, shell scripts, CI workflows and build files. With `--osv` it also looks up the exact dependency versions in lockfiles in [OSV.dev](https://osv.dev/) to report known vulnerabilities and malicious packages. It does not execute scanned code.
29
+
30
+ ## Project status
31
+
32
+ Early prototype. It scans selected Python, JavaScript, TypeScript, configuration, and dependency-manifest files. Python rules match real calls using the standard-library `ast` module; Go, Rust, Java/Kotlin, PHP and Ruby rules run on a small lexer that separates code from comments and strings; JavaScript, TypeScript, secret, and dependency rules are pattern-based. Findings do not prove that code is malicious or that a credential is valid; false positives and false negatives are possible.
33
+
34
+ ## Requirements
35
+
36
+ - Python 3.9 or later
37
+ - No runtime dependencies
38
+
39
+ ## Installation
40
+
41
+ Clone the public repository and install locally:
42
+
43
+ ```bash
44
+ git clone https://github.com/emanuellzoe/aeppo.git
45
+ cd aeppo
46
+ python3 -m pip install .
47
+ ```
48
+
49
+ This installs the `aeppo` command using the package metadata in `pyproject.toml`. Check the installed version with `aeppo --version`.
50
+
51
+ Or run directly from a checkout without installing:
52
+
53
+ ```bash
54
+ python3 -m aeppo.cli scan PATH
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ ```bash
60
+ aeppo scan PATH
61
+ aeppo scan PATH --format json
62
+ aeppo scan PATH --format sarif --output aeppo.sarif
63
+ aeppo scan PATH --min-severity medium
64
+ aeppo scan PATH --baseline aeppo-baseline.json
65
+ aeppo scan PATH --exclude '**/generated/**' --max-file-size 524288
66
+ aeppo scan PATH --disable GHA003 --disable SH005
67
+ aeppo scan app.py scripts/deploy.sh # several files or directories at once
68
+ aeppo scan PATH --osv # also check lockfile dependencies in OSV.dev
69
+ ```
70
+
71
+ aeppo scans `.py`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.mts`, `.cts`, `.go`, `.rs`, `.java`, `.kt`, `.kts`, `.php`, `.phtml`, `.rb`, `.rake`, `.gemspec`, `Gemfile`, `Rakefile`, shell scripts (`.sh`, `.bash`, `.zsh`, `.ksh`, `.ps1`, `.envrc`, and extensionless files with a shell shebang), files that run automatically when a repository is opened, built or installed (`.vscode/tasks.json`, `devcontainer.json`, `Dockerfile`/`Containerfile`, `build.rs`, `composer.json`, Gradle and Maven builds, MSBuild project files, `//go:generate` in `.go` files), GitHub Actions workflows (`.github/workflows/*.yml`) and `action.yml` files, Markdown (`.md`, `.markdown`, `.mdx`; secret rules only), `.yaml`, `.yml`, `.toml`, `.json`, `.ini`, `.cfg`, `.env` and any `.env.*` file (such as `.env.local` or `.env.staging`), `requirements.txt`, and `package.json`. It skips hidden directories and common generated/vendor directories without descending into them. `--exclude` accepts a relative path glob and may be repeated. Files larger than 1 MiB are skipped by default; override the limit with `--max-file-size BYTES`. A file that cannot be read is skipped with a warning on standard error instead of stopping the scan.
72
+
73
+ | Option | Effect |
74
+ |---|---|
75
+ | `--format text\|json\|sarif` | Output format (default `text`) |
76
+ | `--output FILE` | Write the report to `FILE` instead of standard output |
77
+ | `--min-severity low\|medium\|high` | Report only findings at or above this severity (default `low`) |
78
+ | `--baseline FILE` | Ignore findings already recorded in a JSON report (see below) |
79
+ | `--disable RULE` | Turn off a rule ID; may be repeated. Unknown IDs are an error |
80
+ | `--config FILE` / `--no-config` | Use a specific settings file, or ignore `.aeppo.toml` (see below) |
81
+ | `--osv` | Look up lockfile dependency versions in OSV.dev (see [below](#known-vulnerable-and-malicious-dependencies)) |
82
+ | `--skip-unsupported` | Skip file arguments aeppo cannot scan instead of failing (used by the pre-commit hook) |
83
+
84
+ Text output includes the path, line number, rule ID, severity, confidence, category, explanation, and recommendation. JSON output is an array of findings with `path`, `line`, `rule_id`, `message`, `severity`, `confidence`, `category`, `recommendation`, and `fingerprint` fields. SARIF output follows SARIF 2.1.0 and can be uploaded to GitHub code scanning.
85
+
86
+ Exit codes:
87
+
88
+ - `0`: scan completed with no findings (after severity, suppression, and baseline filtering)
89
+ - `1`: scan completed and findings were reported
90
+ - `2`: target could not be scanned, arguments were invalid, the config/baseline/output file could not be used, or `--osv` could not reach OSV.dev (the report of the other rules is still printed)
91
+
92
+ ## Configuration file
93
+
94
+ Put project settings in `.aeppo.toml` so every run (CLI, pre-commit, GitHub Action) uses the same ones:
95
+
96
+ ```toml
97
+ exclude = ["tests/fixtures/**", "vendor/**"] # relative path globs
98
+ disable = ["SH005"] # rule IDs to turn off
99
+ min-severity = "medium" # low | medium | high
100
+ max-file-size = 1048576 # bytes
101
+ baseline = "aeppo-baseline.json" # relative to this file
102
+ osv = true # same as --osv
103
+ ```
104
+
105
+ aeppo looks for `.aeppo.toml` starting from the scanned directory and moving up to the repository root (the first directory containing `.git`). When several paths or individual files are given, as pre-commit does, the search starts from the current directory. Use `--config FILE` to choose a file or `--no-config` to ignore it.
106
+
107
+ - Command-line options win: `--min-severity`, `--max-file-size`, and `--baseline` replace the file's values, while `--exclude` and `--disable` add to them.
108
+ - Exclude globs are matched against paths relative to the scanned directory, or against the path as given for file arguments. Keep the file at the repository root and scan from there.
109
+ - Unknown keys, unknown rule IDs, and invalid values are errors (exit code 2), so a typo cannot silently turn a setting off.
110
+ - Python 3.11+ reads the file with `tomllib`. Python 3.9 and 3.10 use a built-in parser for top-level keys with strings, integers, booleans, and arrays, so aeppo still has no runtime dependencies.
111
+
112
+ ## pre-commit
113
+
114
+ Scan staged files before every commit with [pre-commit](https://pre-commit.com/). Add this to `.pre-commit-config.yaml` (pin `rev` to a release commit SHA):
115
+
116
+ ```yaml
117
+ repos:
118
+ - repo: https://github.com/emanuellzoe/aeppo
119
+ rev: 8aa10353d22c6ea6c0b3d7f903efbb0cd6ce6eb0 # v0.7.0
120
+ hooks:
121
+ - id: aeppo
122
+ ```
123
+
124
+ The hook passes the staged files to `aeppo scan --skip-unsupported`, so files aeppo does not understand are skipped. It reads the repository's `.aeppo.toml`, and a finding blocks the commit until it is fixed, suppressed with `aeppo: ignore[RULE]`, or recorded in a baseline.
125
+
126
+ ## Suppressing reviewed findings
127
+
128
+ After reviewing a finding, silence it with a comment on the same line or on the line above:
129
+
130
+ ```python
131
+ subprocess.run(command, shell=True) # aeppo: ignore[PY003]
132
+
133
+ # aeppo: ignore-next-line[SEC001]
134
+ EXAMPLE_KEY = "..."
135
+ ```
136
+
137
+ `aeppo: ignore` without a rule list covers every rule on that line. Prefer listing rule IDs so new kinds of findings on the same line are still reported. The comment works in any scanned file that allows comments (`#`, `//`, and so on).
138
+
139
+ ## Baselines
140
+
141
+ To adopt aeppo in an existing repository without fixing every historical finding first, record the current findings and pass them back on later runs:
142
+
143
+ ```bash
144
+ aeppo scan . --format json --output aeppo-baseline.json
145
+ aeppo scan . --baseline aeppo-baseline.json
146
+ ```
147
+
148
+ Findings are matched by path, rule ID, and a fingerprint of the whitespace-normalized source line, so they stay matched when surrounding lines move. Editing the flagged line or adding a new finding makes it reported again. Review the baseline file before committing it, because it records where secrets were found (but not the secret values).
149
+
150
+ ## Known-vulnerable and malicious dependencies
151
+
152
+ `aeppo scan PATH --osv` reads the exact versions pinned in lockfiles and looks them up in [OSV.dev](https://osv.dev/), which aggregates the GitHub Advisory Database, PyPA, RustSec, the Go vulnerability database, RubySec and the [OpenSSF Malicious Packages](https://github.com/ossf/malicious-packages) feed.
153
+
154
+ | Ecosystem | Files read |
155
+ |---|---|
156
+ | npm | `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock` (classic and Berry), `pnpm-lock.yaml` (v5 to v9) |
157
+ | PyPI | `poetry.lock`, `uv.lock`, `requirements*.txt` and `requirements/*.txt` (only `name==version` pins) |
158
+ | crates.io | `Cargo.lock` |
159
+ | Go | `go.mod` `require` directives, after `replace` (`go.sum` also lists versions that are not used) |
160
+ | Packagist | `composer.lock` |
161
+ | RubyGems | `Gemfile.lock` (`GEM` section) |
162
+
163
+ | ID | Detection | Severity |
164
+ |---|---|---|
165
+ | `VULN001` | A pinned version is affected by a published advisory. The message names the advisory and CVE, and the recommendation names the first fixed version | From the advisory: GitHub severity or the CVSS v3 score (critical and high are reported as `high`); `medium` when the advisory gives none; `low` for informational RustSec notices such as `unmaintained` |
166
+ | `MAL001` | A pinned version is listed as malicious (`MAL-` advisories) | Always `high` |
167
+
168
+ - **What is sent:** only the ecosystem, package name and version of each locked dependency, to `api.osv.dev`. Nothing else leaves the machine. Without `--osv` (or `osv = true`) aeppo makes no network requests. Packages from workspaces, local paths, git and URL sources are not sent, but private registry packages listed in a lockfile are; do not use `--osv` if their names are confidential.
169
+ - **Cache:** full advisory records are cached in `~/.cache/aeppo/osv` (`$XDG_CACHE_HOME` or `$AEPPO_CACHE_DIR` override it) and refetched when OSV reports a newer revision. Every scan still asks OSV which advisories apply, so newly published ones are reported the next time you scan.
170
+ - **Findings** point at the lockfile line of the package and work with `--min-severity`, `--disable`, baselines and SARIF like other rules. Their fingerprint is the package, version and advisory, so upgrading the package clears the finding from a baseline match. Lockfiles cannot carry suppression comments; use a baseline or `--disable` instead.
171
+ - Lockfiles are read up to 64 MiB regardless of `--max-file-size`; `node_modules` and hidden directories are skipped.
172
+ - A version range in `package.json`, `pyproject.toml` or an unpinned `requirements.txt` line is not checked, because the installed version is not known. Commit a lockfile to have it checked.
173
+ - An advisory matching a version does not mean the vulnerable code is reachable from the project; review the advisory before treating it as exploitable.
174
+
175
+ ## GitHub Action
176
+
177
+ Add aeppo to a workflow after checking out the repository:
178
+
179
+ ```yaml
180
+ name: Security scan
181
+ on:
182
+ pull_request:
183
+ permissions:
184
+ contents: read
185
+ jobs:
186
+ aeppo:
187
+ runs-on: ubuntu-latest
188
+ steps:
189
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
190
+ - uses: emanuellzoe/aeppo@8aa10353d22c6ea6c0b3d7f903efbb0cd6ce6eb0 # v0.7.0
191
+ with:
192
+ path: .
193
+ format: json
194
+ exclude: |
195
+ **/generated/**
196
+ max-file-size: "1048576"
197
+ min-severity: low
198
+ fail-on-findings: "true"
199
+ ```
200
+
201
+ Both actions are pinned to full commit SHAs; verify the source and update the pins deliberately when upgrading. Release commits are listed on the [releases page](https://github.com/emanuellzoe/aeppo/releases). The action runs the scanner on the GitHub runner, does not execute scanned code, and requires only repository read permission. Findings fail the job by default; set `fail-on-findings: "false"` to report findings without failing the job.
202
+
203
+ | Input | Default | Description |
204
+ |---|---|---|
205
+ | `path` | `.` | File or directory to scan |
206
+ | `format` | `text` | `text`, `json`, or `sarif` |
207
+ | `exclude` | | Newline-separated relative path globs |
208
+ | `max-file-size` | `1048576` | Skip larger files (bytes) |
209
+ | `min-severity` | `low` | `low`, `medium`, or `high` |
210
+ | `baseline` | | JSON baseline written by `aeppo scan --format json` |
211
+ | `output-file` | | Write the report to this file instead of the log |
212
+ | `fail-on-findings` | `true` | Fail the job when findings are reported |
213
+ | `osv` | `false` | `"true"` checks lockfile dependencies in OSV.dev (`VULN001`, `MAL001`); needs network access from the runner |
214
+ | `python-version` | `3.12` | Python used to run aeppo |
215
+
216
+ ### Uploading results to GitHub code scanning
217
+
218
+ Write SARIF to a file and upload it so findings appear as code scanning alerts and pull-request annotations. Uploading needs `security-events: write`; `if: always()` uploads even when findings fail the scan step.
219
+
220
+ ```yaml
221
+ permissions:
222
+ contents: read
223
+ security-events: write
224
+ jobs:
225
+ aeppo:
226
+ runs-on: ubuntu-latest
227
+ steps:
228
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
229
+ - uses: emanuellzoe/aeppo@8aa10353d22c6ea6c0b3d7f903efbb0cd6ce6eb0 # v0.7.0
230
+ with:
231
+ format: sarif
232
+ output-file: aeppo.sarif
233
+ - uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
234
+ if: always()
235
+ with:
236
+ sarif_file: aeppo.sarif
237
+ ```
238
+
239
+ SARIF locations are written relative to the working directory, which is the repository root on GitHub runners.
240
+
241
+ ## Current rules
242
+
243
+ | ID | Detection | Notes |
244
+ |---|---|---|
245
+ | `PY001` | `os.system(...)` or `os.popen(...)` call, including aliases, `__import__("os")`, `importlib.import_module("os")`, and `getattr(os, "system")` | Matched on the syntax tree; comments and strings are ignored |
246
+ | `PY002` | Call to the built-in `eval(...)` or `exec(...)` | Method calls such as `model.eval()` are not reported |
247
+ | `PY003` | `subprocess` call with `shell=True`, `getoutput`/`getstatusoutput`, or a shell argument list such as `["sh", "-c", command]` whose command is not a literal | Running a script file or a literal `-c` command is not reported |
248
+ | `PY004` | `pickle`/`dill` `load`, `loads`, or `Unpickler` | Unsafe only when the data is untrusted |
249
+ | `PY005` | `yaml.load`/`load_all` without a safe loader, or `yaml.unsafe_load` | `SafeLoader`/`CSafeLoader` and `yaml.safe_load` are not reported |
250
+ | `PY006` | Interactive shell: `subprocess` with `["/bin/sh", "-i"]`, or `pty.spawn` of a shell | Common reverse-shell and backdoor shape |
251
+ | `JS001` | `eval(` call, or `eval` passed as a callback such as `.then(eval)` | Method calls named `eval` are not reported |
252
+ | `JS002` | `exec(`/`execSync(` called bare, on `child_process`, on a `child_process` alias, or on `require('child_process')`; `spawn`/`execFile` of a shell with `-c` and a non-literal command | A bare `exec(` is reported only in files that mention `child_process`, so local helpers named `exec` are not reported. `RegExp.prototype.exec` and method definitions named `exec` are not reported either |
253
+ | `JS003` | `Function(...)` with or without `new`, or `setTimeout`/`setInterval` with a string argument | Type annotations such as `cb: Function` and methods named `Function` (Babel visitors) are not reported |
254
+ | `SRC001` | Bidirectional Unicode control characters in Python, JavaScript, TypeScript, Go, Rust, Java/Kotlin, PHP or Ruby source ([Trojan Source](https://trojansource.codes/)) | Data files such as translations are not checked; suppress intended uses inside string literals |
255
+ | `SEC001` | AWS access key ID pattern beginning with `AKIA` | Does not validate the key or determine whether it is active |
256
+ | `SEC002` | GitHub token patterns beginning with `ghp_`, `gho_`, `ghu_`, `ghs_`, or `ghr_` | Does not validate the token |
257
+ | `SEC003` | Common PEM private-key headers | Detects a header, not whether the complete key is valid |
258
+ | `SEC004` | Slack token (`xoxb-`, `xoxp-`, ... followed by numeric IDs) | Does not validate the token |
259
+ | `SEC005` | Stripe live secret or restricted key (`sk_live_`, `rk_live_`) | Test-mode keys are not reported |
260
+ | `SEC006` | OpenAI API key (`sk-proj-`, `sk-svcacct-`, `sk-admin-`, or legacy `sk-` keys) | Short placeholders are not reported |
261
+ | `SEC007` | Anthropic API key (`sk-ant-api03-` and similar versioned prefixes) | Does not validate the key |
262
+ | `SEC008` | Google API key beginning with `AIza` | Does not validate the key |
263
+ | `DEP001` | Unconstrained requirement in `requirements.txt` | Dependency hygiene signal; not a vulnerability verdict |
264
+ | `DEP002` | Direct URL, VCS, or local dependency reference | Verify the source and pin to an immutable revision |
265
+ | `DEP003` | npm install lifecycle script in `package.json` | Review commands before installing dependencies |
266
+ | `DEP004` | Install or `prepare` script that downloads content and pipes it into a shell or interpreter (`curl ... \| sh`, `bash <(curl ...)`) | Reported in addition to `DEP003` |
267
+
268
+ Python files that cannot be parsed (for example Python 2 sources) fall back to line-based patterns for `PY001` and `PY002`.
269
+
270
+ ### Shell scripts
271
+
272
+ | ID | Detection | Notes |
273
+ |---|---|---|
274
+ | `SH001` | Download piped into an interpreter (`curl ... \| sh`, `\| bash -s`, `\| python3`), `source <(curl ...)`, `eval "$(curl ...)"` | `\| python3 -m json.tool`, `\| jq`, `\| node script.js` and `sh -c` only process data and are not reported |
275
+ | `SH002` | Reverse shells: `bash -i >& /dev/tcp/...`, `nc -e /bin/sh`, `socat ... exec:sh`, `mkfifo` + `nc` | A plain `/dev/tcp` health check (wait-for-it) is not reported |
276
+ | `SH003` | Encoded payload decoded and run (`base64 -d \| sh`, `eval "$(... base64 -d)"`, `xxd -r \| sh`) | Decoding to a file is not reported |
277
+ | `SH004` | Persistence: appending to `authorized_keys`, installing a cron entry (`\| crontab -`, writes to `/etc/cron*`) | `crontab -l` is not reported |
278
+ | `SH005` | Appending to a shell startup file (`~/.bashrc`, `~/.zshrc`, `~/.profile`) | Low severity: installers do this legitimately |
279
+
280
+ ### GitHub Actions
281
+
282
+ | ID | Detection | Notes |
283
+ |---|---|---|
284
+ | `GHA001` | `pull_request_target` workflow that checks out or fetches the pull request's code (`ref: ${{ github.event.pull_request.head.sha }}`, `gh pr checkout`) | The "pwn request" pattern; checking out `github.sha` is not reported |
285
+ | `GHA002` | Untrusted context (issue/PR title or body, comment body, `github.head_ref`, commit messages) expanded inside `run:` or `script:` | Passing the value through `env:` is the fix and is not reported |
286
+ | `GHA003` | Action referenced by a tag or branch instead of a full commit SHA | `low` for `actions/*` and `github/*`, `medium` for third-party actions; local `./` actions are not reported |
287
+ | `GHA004` | `permissions: write-all` | `high` when the workflow also runs on `pull_request_target`, `workflow_run` or `issue_comment` |
288
+
289
+ ### Auto-run entry points
290
+
291
+ A backdoor in a cloned repository usually sits where a tool runs code without being asked, not in application code. These files are read without a language parser. Commands embedded in them are checked with the shell rules (`SH001`–`SH004`), so `curl … | sh` in a Dockerfile `RUN` step, a VS Code task, a `//go:generate` line or an MSBuild `<Exec>` is reported too.
292
+
293
+ | ID | Detection | Notes |
294
+ |---|---|---|
295
+ | `AUTO001` | `.vscode/tasks.json` task with `"runOn": "folderOpen"` | Runs as soon as the folder opens in VS Code (once automatic tasks are allowed) |
296
+ | `AUTO002` | `devcontainer.json` `initializeCommand` | Runs on the **host** before the container starts; in-container commands such as `postCreateCommand` are not reported |
297
+ | `BLD001` | Build script starts a shell or download tool: `build.rs` `Command::new("sh"/"curl"…)` (medium), Gradle `commandLine`/`exec {}`/`.execute()` (low), `exec-maven-plugin` running a shell (medium) | `build.rs` runs on every build and when rust-analyzer opens the project; Gradle runs on IDE import. `Command::new("git")` is not reported |
298
+ | `BLD002` | Build script uses the network: `build.rs` with `reqwest`/`ureq`/`TcpStream` (high), Gradle `URL(...).readText()` (high), MSBuild `<DownloadFile>` (medium) | |
299
+ | `DEP003` / `DEP004` | Composer install hooks (`post-install-cmd`, `post-autoload-dump`, …); `DEP004` when one pipes a download into an interpreter | Composer hooks are routine in frameworks, so `DEP003` is low for Composer |
300
+
301
+ `SH001` also covers PowerShell download cradles (`iwr … | iex`, `IEX (… DownloadString(…))`), and `SH003` covers `powershell -EncodedCommand`. `.envrc` is scanned as a shell script because direnv runs it on `cd`.
302
+
303
+ ### Go, Rust, Java/Kotlin, PHP and Ruby
304
+
305
+ These rules run on a lexer that blanks out comments and string contents, so call shapes inside comments, documentation strings, PHP's surrounding HTML, Ruby regex literals and heredocs do not match. A shell started with a **plain string literal** as its command is not reported for that alone; the literal is checked with the shell rules instead, so `exec.Command("sh", "-c", "curl … | sh")` reports `SH001` while `exec.Command("sh", "-c", "make test")` stays quiet. The argv form (`exec.Command("git", "log", ref)`, `system("git", "log", ref)`) runs no shell and is not reported.
306
+
307
+ | ID | Detection | Notes |
308
+ |---|---|---|
309
+ | `GO001` | `exec.Command`/`CommandContext` running `sh`/`bash`/`cmd`/`powershell` with `-c`//`/C` and a command built at runtime | |
310
+ | `RS001` | `std::process::Command::new("sh")` with `.arg("-c")`/`.args([...])` and a runtime command, across a multi-line builder chain | In `build.rs` the line is reported as `BLD001` instead |
311
+ | `JV001` | `ProcessBuilder(...)`, `.command(...)` or `Runtime.exec(new String[]{...})` running a shell with `-c` and a runtime command; `List.of`, `Arrays.asList`, Kotlin `arrayOf`/`listOf` are unwrapped | |
312
+ | `JV002` | `Runtime.getRuntime().exec(cmd)` (or a `Runtime` variable) with a runtime command string | medium: the string is split on spaces, not run by a shell |
313
+ | `JV003` | `ObjectInputStream` + `.readObject()` | medium; legitimate in RPC code, dangerous on untrusted input |
314
+ | `PHP001` | `eval`, `create_function`, `assert` of a string, `preg_replace` with `/e` | low for `eval` of a plain literal; the message calls out `eval(base64_decode(…))`-style web shells and request data |
315
+ | `PHP002` | `system`, `exec`, `shell_exec`, `passthru`, `popen`, `proc_open`, `pcntl_exec`, backticks with a runtime command | high with `$_GET`/`$_POST`/`$_REQUEST`/`$_COOKIE`/`$_SERVER`, low when wrapped in `escapeshellarg`; `$pdo->exec()` and `Foo::system()` are not calls to these functions |
316
+ | `PHP003` | `unserialize` of a non-literal | low by default (common for internal caches), high with request data; not reported with `allowed_classes` |
317
+ | `RB001` | `eval` of a non-literal (with or without parentheses) | `obj.eval` and method definitions are ignored |
318
+ | `RB002` | `system`, `exec`, `spawn`, `IO.popen`, `Open3.*` with a single runtime string, or a shell with `-c`; interpolated backticks and `%x()` | high with `params[...]`; splats and argv forms are not reported |
319
+ | `RB003` | `Marshal.load` / `Marshal.restore` | medium |
320
+ | `NET001` | Network connection (`net.Dial`, `TcpStream::connect`, `new Socket`, `fsockopen`, `TCPSocket.new`) in the same file as an interactive shell (`/bin/sh`, `sh -i`), or a Go process whose `Stdin`/`Stdout` is the dialed connection | Reverse-shell pattern |
321
+
322
+ During directory traversal, aeppo enters `.github/workflows`, `.vscode` (only `tasks.json`) and `.devcontainer`, but skips other hidden directories, `.git`, `.hg`, `.svn`, `.venv`, `venv`, `__pycache__`, and `node_modules`.
323
+
324
+ ## Security limitations
325
+
326
+ - Scanning is static and limited to the source and configuration formats listed above; target code and dependency scripts are not executed.
327
+ - Python rules follow import aliases, `__import__`, `importlib.import_module`, and `getattr` with literal names within a single file only. Calls reached through variables, wrappers, or names built at runtime are not detected.
328
+ - Names assembled at runtime, such as `globalThis['ev' + 'al']`, are out of reach for pattern-based rules. aeppo is a review aid, not a reliable detector of deliberately obfuscated backdoors.
329
+ - JavaScript, TypeScript, and secret rules are regular expressions and can miss obfuscated variants or produce false positives.
330
+ - Values that look like placeholders are still reported, but at `low` severity and confidence. This covers values containing `EXAMPLE` (such as the AWS documentation key) and values whose tail repeats one or two characters (`ghp_xxxx...`). Use `--min-severity medium` to hide them. Other well-formed dummy values are reported normally; suppress or baseline them after review.
331
+ - `SEC003` matches the private-key header line only, so headers quoted in documentation or in detection rules are reported too.
332
+ - Go, Rust, Java/Kotlin, PHP and Ruby rules are lexer-based patterns, not type-aware analysis: a shell program or flag held in a variable (`exec.Command(shell, flag, cmd)`), wrapper functions, and aliased imports are not followed, and taint is only approximated (request data on the same call). C, C++, C#, Swift and other languages are checked for secrets and auto-run entry points only.
333
+ - Secret rules also run on these source files, so test fixtures (for example in secret scanners' own `_test.go` files) can report secret findings; exclude them in `.aeppo.toml` if that is noise.
334
+ - Do not post findings containing secrets in public issues. If a real secret is detected, treat it as exposed and revoke or rotate it with the relevant provider.
335
+ - Do not treat a sandbox as an absolute guarantee if dynamic analysis is added in the future.
336
+ - `DEP` rules flag review signals only. Known vulnerabilities and malware are reported only with `--osv`, only for versions pinned in a lockfile, and only when OSV.dev lists them; a new malicious package can be in use before any database lists it.
337
+
338
+ ## Tests
339
+
340
+ ```bash
341
+ python3 -m unittest discover -s tests -v
342
+ ```
343
+
344
+ Contributions adding rules should include positive and negative tests with dummy values, never real credentials. Split dummy secrets and risky call strings in test sources (for example `"AKIA" + "..."`) so aeppo's own scan of this repository stays clean.
345
+
346
+ ## Contributing, security and changes
347
+
348
+ - [CONTRIBUTING.md](CONTRIBUTING.md): development setup, module layout, and how to add a rule with corpus samples.
349
+ - [SECURITY.md](SECURITY.md): how to report a vulnerability privately.
350
+ - [CHANGELOG.md](CHANGELOG.md): what changed in each release.
351
+
352
+ ## License
353
+
354
+ aeppo is distributed under the MIT License. See `LICENSE` for the full text.