Skip to content

sec(subagent): secret_key has no length bound in secret request prompt #1480

@bug-ops

Description

@bug-ops

Summary

In process_pending_secret_requests() (crates/zeph-core/src/agent/mod.rs), req.secret_key is embedded directly in the confirmation prompt with no length bound:

let prompt = format!(
    "Sub-agent requests secret '{}'. Allow?{}",
    req.secret_key,  // no length cap
    ...
);

secret_key is pre-validated to [a-zA-Z0-9_-] (ASCII-only, see manager.rs comment), so there is no panic risk on UTF-8 char boundaries. However, there is no upper length limit enforced, so a malicious or buggy sub-agent could supply an arbitrarily long key name and produce an oversized prompt string.

Severity

Low. The key is ASCII-validated so no panic. The oversized prompt is only shown to the operator for confirmation. No data loss or security bypass possible.

Steps to Reproduce

  1. Spawn a sub-agent that sends a SecretRequest with a secret_key of e.g. 10,000 ASCII characters.
  2. Observe that the confirmation prompt displayed to the operator is extremely long.

Expected Behavior

secret_key should be bounded (e.g., to 100 chars) before being embedded in the prompt, consistent with how reason is now bounded.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions