Skip to content

Commit 1591f84

Browse files
committed
chore(project-lethe): update local codebase changes and synchronize WAF engine modules
1 parent b0ee11a commit 1591f84

70 files changed

Lines changed: 9853 additions & 1503 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.git
2+
.github
3+
.venv
4+
venv
5+
env
6+
__pycache__
7+
*.pyc
8+
.mypy_cache
9+
.pytest_cache
10+
.ruff_cache
11+
.tox
12+
.nox
13+
dist
14+
build
15+
*.egg-info
16+
tests
17+
docs
18+
assets
19+
examples
20+
*.db
21+
*-manifest.json
22+
site-profile.json
23+
.lethe.toml
24+
lethe.toml
25+
project_lethe_review*.md

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: test ${{ matrix.os }} / py${{ matrix.python-version }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: ["3.10", "3.11", "3.12", "3.13"]
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e ".[dev]"
27+
- name: Test
28+
run: pytest -q
29+
30+
lint:
31+
name: lint and types
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: actions/setup-python@v5
36+
with:
37+
python-version: "3.12"
38+
- name: Install
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install -e ".[dev]"
42+
- name: Ruff
43+
run: ruff check src tests
44+
- name: Mypy
45+
run: mypy

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@ build/
1717
dist/
1818
*.egg-info/
1919

20+
# Tooling caches
21+
.mypy_cache/
22+
.pytest_cache/
23+
.ruff_cache/
24+
.tox/
25+
.nox/
26+
27+
# Lethe local artifacts
28+
*.db
29+
*-manifest.json
30+
site-profile.json
31+
2032
# Local review notes
2133
project_lethe_review*.md

CHANGELOG.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Changelog
2+
3+
All notable changes to Project Lethe are documented here. The format is based on
4+
[Keep a Changelog](https://keepachangelog.com/), and the project aims to follow
5+
[Semantic Versioning](https://semver.org/). Dates are omitted where unknown.
6+
7+
## [Unreleased]
8+
9+
### Fixed
10+
- **Payloads were double-encoded on the wire (critical).** The `test`/`discover`
11+
query and form-body injection used `urlencode`, which re-encoded `%` in
12+
already-encoded payloads (e.g. `%3Cscript%3E` became `%253Cscript%253E`).
13+
The application then never saw the decoded payload, silently neutralizing the
14+
URL-encoding family of techniques. Payloads now reach the wire verbatim, with
15+
only request-invalid characters (controls, space, DEL, non-ASCII) percent-encoded.
16+
- **Scope port over-permissiveness.** A port-specific allow rule
17+
(`example.com:8443`) wrongly matched a default-port URL (`https://example.com/`).
18+
The URL's implicit port is now resolved from its scheme (https=443, http=80) so
19+
port-scoped rules match exactly; portless rules still match any port.
20+
- Same wire-encoding fix applied to the mutation proxy's request rewriting.
21+
22+
## [0.15.0]
23+
24+
### Added
25+
- **HTTPS interception for the mutation proxy** (`proxy --https`) via a local CA
26+
that mints per-host leaf certificates on demand. Optional `[mitm]` extra
27+
(`cryptography`); core stays dependency-free. Upstream TLS is still verified.
28+
29+
### Changed
30+
- Split `cli.py`: extracted config coercion helpers into `cli_config.py` and the
31+
output formatters into `cli_render.py`, with no behavioral change.
32+
33+
## [0.14.0]
34+
35+
### Added
36+
- `http-run`: execute HTTP/1.1 discrepancy templates over raw sockets against an
37+
authorized target (HTTP/2 templates remain text-only and are skipped).
38+
- `schema`: ingest OpenAPI/Swagger or GraphQL introspection and recommend
39+
type-aware profiles, contexts, and technique tags per parameter.
40+
- `proxy`: scope-gated HTTP mutation middleware that mutates live traffic in place.
41+
- Export generated variants as Nuclei templates or Burp BCheck scripts
42+
(`generate --format nuclei|bcheck`).
43+
- Vendor-tuned profiles (`cloudflare`, `akamai`, `aws_waf`, `imperva`,
44+
`modsecurity`, `f5`) that `fingerprint` recommends automatically.
45+
- Path/header normalization mutators: `path_empty_segment`, `path_dot_segment`,
46+
`semicolon_url_encode`.
47+
- `generate --output` to write variants to a file (parity with other commands).
48+
49+
### Fixed
50+
- BOM-tolerant reading of user-provided files (schema, feeds, site profile,
51+
request file, HAR) so Windows-emitted UTF-8 BOMs no longer break parsing.
52+
- Clarified `_waf_header_signal` logic (no behavioral change).
53+
54+
## [0.13.0]
55+
56+
### Added
57+
- **Oracle-guided `discover` engine**: evolves technique chains against a target,
58+
keeps survivors, flags novel bypasses, and delta-debug-minimizes them.
59+
- **n-day knowledge feeds** (`feeds`): an inert, versioned pack mapping bypass
60+
classes to profiles/techniques, surfaced automatically during `fingerprint`.
61+
- **Per-engine and advanced techniques**: MySQL/MSSQL/Postgres SQLi profiles,
62+
SSTI and shell profiles, SQL keyword comment insertion, IPv4 decimal/octal/hex
63+
encodings, and shell separator/quote mutators.
64+
- **Trustworthy verdicts**: per-target oracle calibration, multi-sample baselines,
65+
and automatic bypass re-confirmation.
66+
- **Reflection-context detection**: labels where a payload landed (HTML body,
67+
attribute, script, JSON, ...) and flags `likely_exploitable`.
68+
- New `STYX://PROJECT-LETHE` "canonicalization resolve" banner animation.
69+
70+
### Changed
71+
- Cross-platform CI matrix (Linux/macOS/Windows x 3.10-3.13), ruff + mypy gates,
72+
`noxfile.py`, Dockerfile, and packaging metadata. Fixed the Windows-only test
73+
failures (temp-file handling and POSIX file-mode assumptions).
74+
75+
## [0.12.0]
76+
77+
### Added
78+
- **Active testing core.** `test` command that injects generated variants at an
79+
authorized target and classifies each response (blocked, passed, rate-limited,
80+
challenged, origin error, inconclusive) with confidence and signals.
81+
- **Default-deny scope guard** (hosts, wildcards, ports, CIDRs; flags, file, or
82+
config) enforced before any traffic is sent.
83+
- **WAF/CDN fingerprinting** with technique suggestions.
84+
- Concurrency, rate limiting, and proxy pass-through (`--proxy`).
85+
- **Context-aware mutators** (`--context`) and a charset/normalization engine:
86+
NFKC compatibility homoglyphs, overlong UTF-8, and inconsistent partial encoding.
87+
- Request import from `curl`, raw HTTP, or HAR (`--curl`/`--request-file`/`--har`,
88+
with the `§INJECT§` marker).
89+
- Local SQLite session store and `history`, integrity-hashed run manifests, and
90+
versioned (`schema_version`) JSON output with documented exit codes.
91+
92+
## [0.11.0]
93+
94+
- Initial baseline: deterministic payload mutation engine, context profiles,
95+
`explain`/`analyze`, single-request site profiling, HTTP discrepancy templates,
96+
auth memory, and the AI safety planner/report layer.

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Project Lethe - minimal, dependency-free image.
2+
# Build: docker build -t project-lethe .
3+
# Run: docker run --rm project-lethe --help
4+
FROM python:3.12-slim AS build
5+
6+
WORKDIR /src
7+
COPY pyproject.toml README.md LICENSE ./
8+
COPY src ./src
9+
10+
RUN python -m pip install --upgrade pip build \
11+
&& python -m build --wheel --outdir /dist
12+
13+
FROM python:3.12-slim
14+
15+
# Run as a non-root user; the tool needs no special privileges.
16+
RUN useradd --create-home --uid 10001 lethe
17+
COPY --from=build /dist/*.whl /tmp/
18+
RUN python -m pip install --no-cache-dir /tmp/*.whl && rm -f /tmp/*.whl
19+
20+
USER lethe
21+
WORKDIR /home/lethe
22+
23+
# Knowledge pack/session caches live under XDG_CACHE_HOME.
24+
ENV XDG_CACHE_HOME=/home/lethe/.cache
25+
26+
ENTRYPOINT ["lethe"]
27+
CMD ["--help"]

0 commit comments

Comments
 (0)