Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Keep local Compose credentials and repository history out of Docker build contexts.
.env
.env.*
**/.env
**/.env.*
.git
**/.git
target
**/target
3 changes: 2 additions & 1 deletion .github/workflows/deep-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ jobs:
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: platform-integration
# Wireless fixtures need no hardware; wireless-tools is runtime-only and unavailable on current Ubuntu.
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ripgrep libpcap-dev wireless-tools iproute2 python3
run: sudo apt-get update && sudo apt-get install -y ripgrep libpcap-dev iproute2 python3
- name: Doctor (centralized prerequisites)
run: cargo run -q -p eggsec-cli -- doctor
- name: Fixture layer (hermetic)
Expand Down
15 changes: 10 additions & 5 deletions .opencode/skills/eggsec-distributed/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,17 @@ Note: `Task::payload` is serializable with `#[serde(default)]` for backward comp

## Command Execution Security

`CommandExecutor` in `command.rs` enforces:
- Only `eggsec` binary allowed
- Max 50 arguments, 1000 chars each
- Forbidden patterns: `../`, path traversal, sensitive paths (`/etc/`, `~/.ssh/`, `.pem`, `.key`)
`CommandExecutor` in `command.rs` accepts operator-selected programs and arguments
without an executable allowlist or argument-pattern filter. It retains these
resource/input bounds:
- Up to 50 arguments plus the program; 1000 bytes per token
- Timeout defaults to 300 seconds and is clamped to 1–300 seconds
- No custom environment variables
- 10MB output limit
- 10 MB output limit

Trust boundary: any peer with the listener PSK can execute arbitrary programs as
the listener account. Use TLS and a dedicated host reachable only by trusted
operators; this is not a command sandbox.

## Testing

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ NSE support remains available as an optional Nmap NSE compatibility layer via th
- Standalone defense-lab pattern (same as wireless, mobile, auth-test, db-pentest)

#### Security
- MCP HTTP server (`mcp-serve`, `codegg-mcp`) now requires `--allow-public-bind` and a non-empty `--api-key` for non-loopback binds; loopback and stdio behavior are unchanged.
- Auth control validation (`eggsec auth-test`): Stabilized under runtime policy gate only (`OperationRisk::CredentialTesting` + `allow_credential_testing` in `ExecutionPolicy`, default false; central `EnforcementContext::evaluate()`). Local `AuthTestReport`/`AuthFinding` only (no canonical conversion or pipeline profile integration). Distinct from `ScanProfile::Auth` (JWT/OAuth/IDOR). TUI `AuthTab` is CLI-only (excluded from `Tab` enum). No dedicated Cargo feature. See `docs/AUTH_LAB.md` and `architecture/auth.md`. All tests green.
- Mobile dynamic testing close-out (Phase 1 + Phase 2a + final polish + close-out polish): Android ADB core + runtime log analysis + Phase 2a proxy Level-1 device config + traffic summary + runtime permission testing all complete 2026-06-12 under `mobile-dynamic` feature (`mobile-dynamic = ["mobile"]`; standalone defense-lab CLI, MCP-absent, `to_scan_report_data_dynamic` bridge with `mobile-dynamic-android-*` categories; auto-bridged in `report convert`; no TUI/pipeline/MCP in this round). Includes a `correlate_findings` helper that populates `DynamicMobileFinding.static_correlation` for high-value static ↔ dynamic overlaps (cleartext traffic ↔ static `usesCleartextTraffic`/network-config; runtime-perm ↔ static declared dangerous perms). Final polish (F2 correlation + F3 parser robustness + F5 report surface + F6 docs) per `plans/mobile-dynamic-phase2-final-polish-handoff-plan.md` (executed). Close-out polish (final code hygiene: `format_dynamic_report` "Phase 2 extensions present" header renamed to "Runtime extensions"; "P1 skeleton"/"stub" doc comments updated to reflect current state; CLI about-string + struct docs updated for Phase 2a; smoke-test script header refreshed; feature gating decision documented to keep all dynamic functionality under `mobile-dynamic` with no `mobile-dynamic-advanced` sub-feature) per `plans/mobile-dynamic-phase2-close-out-polish-plan.md` (executed). Design in `plans/dynamic-mobile-testing-loadout-design-plan.md`; Phase 1 per `plans/mobile-dynamic-phase1-implementation-handoff-plan.md` (executed); Phase 2a per `plans/mobile-dynamic-phase2-implementation-handoff-plan.md` (executed). All tests + smoke + clippy green. See `docs/MOBILE.md`, `architecture/mobile.md`, `crates/eggsec/src/mobile/AGENTS.override.md`, and `scripts/test-mobile-dynamic.sh`.

Expand Down
26 changes: 16 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This directory contains Docker configuration for setting up Eggsec and its test

## Quick Start

Before any `docker compose` command, set the required lab credentials listed under [Required Compose Credentials and Exposure](#required-compose-credentials-and-exposure); unset values fail configuration.

```bash
# Build the image
docker build -t eggsec:latest .
Expand Down Expand Up @@ -42,10 +44,9 @@ docker compose --profile full up -d

## Features Enabled

The Dockerfile builds with `--features full`, enabling:
The Dockerfile builds `eggsec-cli` with `--features full`. This uses the existing curated CLI aggregate: `tui`, `eggsec/full`, optional `eggsec-tui?/full`, `mobile`, `mobile-dynamic`, `wireless-advanced`, `db-pentest`, and `web-proxy`. The nested `eggsec/full` aggregate expands to `cli`, `stress-testing`, `packet-inspection`, `rest-api`, `nse`, `ai-integration`, `websocket`, `headless-browser`, `database`, `container`, `sbom`, `advanced-hunting`, `compliance`, `external-integrations`, `finding-workflow`, `vuln-management`, `wireless`, `wireless-advanced`, `mobile`, `mobile-dynamic`, `db-pentest`, `web-proxy`, `evasion`, `postex`, `c2`, `email-notifications`, `logging-subscriber`, and `config-watch`.

- **stress-testing**: SYN floods, ICMP, raw socket operations
- **packet-inspection**: Live packet capture, hexdump, traceroute
The `db-pentest` surface is intentionally included in `full`; the separate `db-pentest-mssql-tiberius` marker remains opt-in and is not enabled by this Docker build. No feature definitions were changed for this milestone.

## Security Capabilities

Expand All @@ -64,6 +65,20 @@ These are required for packet-level operations. For full packet capture capabili
| EGGSEC_RATE_LIMIT | 50 | Requests per second |
| REDIS_URL | - | Redis connection for distributed mode |

## Required Compose Credentials and Exposure

Compose interpolation requires all of these environment variables, even when the corresponding service profile is not selected. Set strong, lab-specific values in your shell or an untracked local `.env` file before running `docker compose config` or `docker compose up`. The root `.dockerignore` excludes root and nested `.env` / `.env.*` files and Git metadata from Docker build contexts; Compose still reads the project `.env` for interpolation:

- `REDIS_PASSWORD`
- `ELASTIC_PASSWORD`
- `TOR_PASSWORD`
- `POSTGRES_PASSWORD`
- `MYSQL_ROOT_PASSWORD`
- `MYSQL_PASSWORD`
- `MSSQL_SA_PASSWORD` (must satisfy SQL Server password complexity)

There are no default passwords; unset or empty values make Compose fail closed. Use URL-safe characters for `REDIS_PASSWORD`, since it is embedded in `REDIS_URL`. Published service and vulnerable-lab ports bind to `127.0.0.1` only. Elasticsearch keeps `xpack.security.enabled=false` for the lab profile's existing behavior; its host port is loopback-bound and it must not be exposed to an untrusted network.

## Volume Mounts

- `./scan-results:/app/results` - Scan output directory
Expand Down Expand Up @@ -124,5 +139,5 @@ Tor may need time to bootstrap. Check logs: `docker compose logs tor-proxy`
## Notes

- All test targets are intentionally vulnerable - do not expose to untrusted networks
- Default credentials where applicable are documented in target service configs
- Lab credentials must be supplied explicitly through the required environment variables above; do not reuse production credentials
- The eggsec container runs as non-root user for safety, with elevated capabilities only when needed
7 changes: 7 additions & 0 deletions DOCKER_COMPOSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
| `testing` | eggsec + dvwa + juice-shop + webhook-receiver | Test against vulnerable containers |
| `storage` | elasticsearch + kibana | Store/visualize results from external eggsec |
| `full` | everything | Complete testing environment |
| `db-lab` | postgres-lab + mysql-lab + mssql-lab | Intentionally misconfigured database test targets |

---

## Required Credentials and Exposure

Before `docker compose config` or any `up` command, provide non-empty, lab-specific values for `REDIS_PASSWORD`, `ELASTIC_PASSWORD`, `TOR_PASSWORD`, `POSTGRES_PASSWORD`, `MYSQL_ROOT_PASSWORD`, `MYSQL_PASSWORD`, and `MSSQL_SA_PASSWORD`. Set them in your shell or a local untracked `.env` file; there are no hardcoded/default passwords, and Compose intentionally errors if a required value is unset or empty. The SQL Server value must meet its password-complexity policy.

Every published service and vulnerable-lab port binds to `127.0.0.1`, not all host interfaces. Elasticsearch security remains disabled for existing lab behavior; it is loopback-bound and must not be exposed to untrusted networks.

## Quick Start

### 1. Testing Mode (Recommended for development)
Expand Down
33 changes: 6 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Multi-stage Docker build

# Build stage
FROM rust:1.80-bookworm AS builder
FROM rust:1.89-bookworm AS builder

WORKDIR /app

Expand All @@ -15,32 +15,11 @@ RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

# Copy workspace manifests for dependency caching
COPY Cargo.toml Cargo.lock ./
COPY crates/eggsec-core/Cargo.toml crates/eggsec-core/
COPY crates/eggsec/Cargo.toml crates/eggsec/
COPY crates/eggsec-nse/Cargo.toml crates/eggsec-nse/
COPY crates/eggsec-tui/Cargo.toml crates/eggsec-tui/
COPY crates/eggsec-cli/Cargo.toml crates/eggsec-cli/
COPY crates/eggsec-output/Cargo.toml crates/eggsec-output/
COPY crates/eggsec-tool-core/Cargo.toml crates/eggsec-tool-core/
COPY crates/eggsec-agent/Cargo.toml crates/eggsec-agent/

# Create dummy sources to cache dependencies
RUN mkdir -p crates/eggsec-core/src crates/eggsec/src crates/eggsec-nse/src \
crates/eggsec-tui/src crates/eggsec-cli/src crates/eggsec-output/src \
crates/eggsec-tool-core/src crates/eggsec-agent/src && \
touch crates/eggsec-core/src/lib.rs crates/eggsec/src/lib.rs \
crates/eggsec-nse/src/lib.rs crates/eggsec-tui/src/lib.rs \
crates/eggsec-cli/src/main.rs crates/eggsec-output/src/lib.rs \
crates/eggsec-tool-core/src/lib.rs crates/eggsec-agent/src/lib.rs && \
cargo build -p eggsec-cli --release --features full && \
rm -rf crates/*/src

# Copy source code
COPY crates/ crates/

# Build the application with all features
# Copy the complete workspace. Cargo resolves every workspace member, so a
# hand-maintained subset of manifests is not sufficient for a reliable build.
COPY . .

# Build the CLI with the existing curated full feature aggregate
RUN cargo build -p eggsec-cli --release --features full

# Runtime stage
Expand Down
6 changes: 3 additions & 3 deletions architecture/ai_agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,13 @@ pub struct ToolRegistration {
| Function | Filter |
|----------|--------|
| `mcp_tool_registrations("ops-agent")` | All tools with `mcp_metadata_exposable = true` |
| `mcp_tool_registrations("coding-agent")` | Hardcoded narrow allowlist (scan, scan-ports, fingerprint, scan-endpoints, endpoints, waf-detect, search) |
| `mcp_tool_registrations("coding-agent")` | Every metadata-exposable tool; runtime selection intersects the operator's explicit IDs with registry and profile controls |
| `mcp_tool_registrations_default_visible()` | Tools with `mcp_default_visible = true` (passive/safe-active, no feature gate) |
| `rest_tool_registrations()` | `rest_exposable = true` |
| `grpc_tool_registrations()` | `grpc_exposable = true` |
| `agent_tool_registrations()` | `agent_exposable = true` |

**MCP exposure model** (`registration.rs:43-49`):
**MCP exposure model** (`registration.rs:43-49`): The registration function supplies the metadata-exposable superset; live visibility is the operator-selected intersection described above.

```
default_mcp_visible_for_operation(meta) =
Expand Down Expand Up @@ -621,7 +621,7 @@ cargo test --lib -p eggsec tool::

4. **Fail-closed binding**: `validate_request_binding()` rejects any mismatch between approval and request (tool name, target normalization, typed-vs-parameter agreement).

5. **MCP exposure vocabulary**: Use `mcp_metadata_exposable` for tools allowed under expanded profile listing, `mcp_default_visible` for the conservative default subset. The OpsAgent profile returns all `mcp_metadata_exposable` tools — this is profile-expanded, not the conservative default.
5. **MCP exposure vocabulary**: Use `mcp_metadata_exposable` for the compiled exposure boundary and `mcp_default_visible` for the conservative default subset. Both MCP profiles require explicit operator `--allow-tool` selections; the running server intersects them with registry exposure and profile risk controls. Selection is not authorization: strict `LoadedScope`/`EnforcementContext` approval remains mandatory at call time.

6. **FxHashMap everywhere**: Performance-critical paths use `rustc_hash::FxHashMap`/`FxHashSet`, not `std::collections::HashMap`. Verified in: `ToolRegistry`, `AiCache`, `AiPlanner`, `AgentRegistry`, `ResultAggregator`, `MultiAgentCoordinator`, `LongitudinalMemory`, `Finding.metadata`, `RateLimitConfig`.

Expand Down
Loading
Loading