mirror of https://github.com/aliasrobotics/cai.git
The fetch_url SSRF guard guarantees cloud-metadata endpoints (e.g. 169.254.169.254) are ALWAYS blocked, even when CAI_FETCH_ALLOW_INTERNAL is set for an authorised internal pentest. That guarantee could be bypassed with the IPv4-mapped IPv6 form of the IMDS address, e.g. http://[::ffff:169.254.169.254]/ (or its hex form ::ffff:a9fe:a9fe), because the metadata block is a plain string comparison against the bare IPv4 literal. With allow_internal=True the private/reserved check is skipped, so nothing caught the mapped form and the request reached IMDS. Unwrap IPv4-mapped IPv6 addresses to their embedded IPv4 before the metadata and private-range checks in both the literal-IP and DNS-resolved paths. This also hardens the private-range check on Python versions that do not classify mapped addresses as private/link-local. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mike German <mike@stepsventures.com> |
||
|---|---|---|
| .. | ||
| agents | ||
| api | ||
| cli | ||
| commands | ||
| continuous_ops | ||
| core | ||
| ctfs | ||
| fixtures | ||
| integration | ||
| mcp | ||
| others | ||
| prompts | ||
| refusals | ||
| repl | ||
| sdk | ||
| tools | ||
| tracing | ||
| util | ||
| voice | ||
| README.md | ||
| __init__.py | ||
| conftest.py | ||
| fake_model.py | ||
| helpers.py | ||
| test_cli_print_deduplication.py | ||
| test_compact_command.py | ||
| test_config_loader_agents.py | ||
| test_unified_pattern.py | ||
| testing_processor.py | ||
README.md
Tests
Before running any tests, make sure you have uv installed (and ideally run make sync after).
Running tests
make tests
Snapshots
We use inline-snapshots for some tests. If your code adds new snapshot tests or breaks existing ones, you can fix/create them. After fixing/creating snapshots, run make tests again to verify the tests pass.
Fixing snapshots
make snapshots-fix
Creating snapshots
make snapshots-update