Skip to content

fix(security): truncate secret_key in confirmation prompt#1499

Merged
bug-ops merged 2 commits intomainfrom
secret-key-length-bound
Mar 9, 2026
Merged

fix(security): truncate secret_key in confirmation prompt#1499
bug-ops merged 2 commits intomainfrom
secret-key-length-bound

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 9, 2026

Fixes #1480.

Changes

  • crates/zeph-core/src/agent/mod.rs: apply truncate_to_chars(&req.secret_key, 100) at all 3 confirmation prompt sites in process_pending_secret_requests()
  • crates/zeph-core/src/subagent/manager.rs: reject keys longer than 100 chars at the validation layer (ASCII charset check)
  • 2 new unit tests: secret_key_over_100_chars_truncated, secret_key_exactly_100_chars_unchanged

Consistent with the reason field fix in #1456 (200-char cap via truncate_to_chars).

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins — 4942 passed

Cap secret_key at 100 chars in all three confirmation prompt sites using
the existing truncate_to_chars helper. Reject keys longer than 100 chars
at the sub-agent input-validation layer in manager.rs. Add unit tests for
the new truncation boundary.
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate size/S Small PR (11-50 lines) labels Mar 9, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 9, 2026 22:15
@bug-ops bug-ops merged commit 9d72ad7 into main Mar 9, 2026
18 checks passed
@bug-ops bug-ops deleted the secret-key-length-bound branch March 9, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/S Small PR (11-50 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant