fuzz/ directory, these targets leverage libFuzzer and cargo-fuzz to stress-test the system’s most exposed attack surfaces.
Fuzzing Architecture
The harness is structured to bridge “Natural Language Space” (untrusted input strings/blobs) to “Code Entity Space” (internal Rust structs and state machines). Each target consumes a byte slice from the fuzzer and attempts to drive a specific internal component.Data Flow: From Raw Bytes to Validated State
The following diagram illustrates the flow of data through a typical fuzzing target in the Palyra workspace. Fuzzing Pipeline Flow Sources: crates/palyra-common/src/workspace_patch.rs#102-138, crates/palyra-common/src/redaction.rs#24-130Target Catalog
The harness includes nine specialized targets covering the primary ingestion paths of the daemon and CLI.| Target Name | Component Tested | Primary Objective |
|---|---|---|
config_path_parser | palyra-common | Path sanitization and traversal prevention. |
a2ui_json_parser | palyra-a2ui | Validation of the Agent-to-UI JSON envelope. |
webhook_payload_parser | palyra-connectors | Schema enforcement for external webhook triggers. |
workspace_patch_parser | palyra-common | apply_workspace_patch hunk and path logic. |
process_runner_input_parser | palyra-sandbox | Command-line argument and environment variable parsing. |
auth_profile_registry_parser | palyra-auth | Deserialization of AuthProfileRegistry from disk. |
redaction_routines | palyra-common | Leak prevention in redact_url and redact_auth_error. |
channel_payload_validation | palyra-connectors | Message size and capability limit enforcement. |
webhook_replay_verifier | palyra-connectors | Signature and timestamp verification logic. |
Redaction Routines Fuzzing
Theredaction_routines target specifically tests the redaction.rs module. It ensures that no matter the input string, sensitive markers like api_key or bearer tokens are never leaked in plain text when processed by redact_auth_error or redact_url.
Code Entity Association: Redaction
Sources: crates/palyra-common/src/redaction.rs#5-22, crates/palyra-common/src/redaction.rs#49-60, crates/palyra-common/src/redaction.rs#63-86
Implementation Details
Workspace Patch Fuzzing
Theworkspace_patch_parser target exercises the apply_workspace_patch function. This is a critical security boundary where the LLM provides diffs to be applied to the local filesystem.
- Key Function:
apply_workspace_patchcrates/palyra-common/src/workspace_patch.rs#207-211 - Safety Invariants:
- Paths must be relative and stay within
workspace_rootscrates/palyra-common/src/workspace_patch.rs#113-116. - Memory usage must stay within
WorkspacePatchLimitscrates/palyra-common/src/workspace_patch.rs#23-28. - Failures must trigger a best-effort rollback crates/palyra-common/src/workspace_patch.rs#136-137.
- Paths must be relative and stay within
Redaction Logic
Theredaction_routines target validates that SENSITIVE_KEY_MARKERS are correctly identified and handled.
- Sensitive Markers: Includes
access_token,api_key,client_secret, andvault_refcrates/palyra-common/src/redaction.rs#5-22. - Logic: The fuzzer attempts to find strings that bypass
is_sensitive_keywhile still containing secret-like data crates/palyra-common/src/redaction.rs#25-28.
Running Campaigns
Prerequisites
To run the fuzzing harness, the following tools must be installed:- Rust Nightly: Required for
libFuzzerinstrumentation. - cargo-fuzz: Installed via
cargo install cargo-fuzz.
Execution Commands
To start a fuzzing campaign for a specific target:Analyzing Crashes
When a fuzzer finds a crashing input, it is saved tofuzz/artifacts/<target>/. These can be replayed for debugging: