security: input validation hardening (#854)#903
Merged
Conversation
- zeph-gateway: enforce per-field byte limits on WebhookPayload (sender/channel <= 256, body <= 65536) and strip ASCII control chars from sender/channel to prevent prompt injection (#868) - zeph-acp: strip null bytes from tool names before cache key construction to eliminate key collision vector (#872) - zeph-core: bound gateway.max_body_size to 10 MiB in config validation to prevent memory exhaustion from misconfiguration (#875)
This was
linked to
issues
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #854. Implements all three child issues in parallel.
Changes
#868 — Gateway webhook payload validation (
zeph-gateway)WebhookPayload::validate()enforces byte limits:sender/channel<= 256 bytes,body<= 65536 bytes; returns HTTP 422 on failuresanitize_control_chars()strips ASCII control chars (0x00–0x1F, 0x7F, preserving\n) fromsenderandchannel#872 — ACP null-byte cache key collision (
zeph-acp)tool_namebeforeformat!("{session_id}\0{tool_name}")in bothcheck_permissionandrun_permission_handler#875 — Config
max_body_sizeupper bound (zeph-core)validate()rejectsgateway.max_body_size > 10_485_760(10 MiB) with descriptive errorVerification
cargo +nightly fmt --check— passedcargo clippy --workspace -- -D warnings— 0 warningscargo nextest run --workspace --lib --bins— 2722 tests passed