Skip to content

merge: reconcile GitHub and Gitea main branches#2

Merged
AlexMikhalev merged 2 commits into
mainfrom
reconcile/main
Jun 13, 2026
Merged

merge: reconcile GitHub and Gitea main branches#2
AlexMikhalev merged 2 commits into
mainfrom
reconcile/main

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Summary

Reconciles diverged main branches after terraphim_agent 1.20.4 landed on GitHub
while Gitea advanced with hook stdout redaction work (#2344).

Cherry-picked Gitea-only commits onto GitHub main. Sanitized Slack test token
(constructed at runtime) to satisfy GitHub push protection.

Refs terraphim/terraphim-clients#20 (Gitea)

forge-admin added 2 commits June 13, 2026 17:50
…redaction tests Refs #2344

Refactored process_hook_input_with_type() to delegate to a new
process_hook_with_streams() helper that accepts generic AsyncRead +
AsyncWrite parameters. This enables unit testing without subprocess
spawning.

Added 3 new tokio tests that exercise the full I/O pipeline:
- test_process_hook_with_streams_strips_secrets_from_output: confirms
  AWS keys present in hook input do not appear in stdout (AC#3)
- test_process_hook_with_streams_clean_input_unchanged: verifies clean
  input passes through without spurious redaction
- test_process_hook_with_streams_pre_tool_use_also_redacts: verifies
  pre-tool-use hook type also strips secrets

The redaction logic (contains_secrets fast-check + redact_secrets) was
already correct; this change adds the missing end-to-end test coverage.
…ough

Remove the contains_secrets() pre-check gate at hook.rs:130-135, replacing
it with an unconditional call to redact_secrets(). The gate covered only AWS
keys, sk- tokens, password=, secret=, and api_key= patterns; GitHub PATs
(ghp_*), Slack tokens (xox*), and connection strings (postgresql://…) all
bypassed it and were written to stdout in clear text.

- Remove the conditional gate and the contains_secrets import from hook.rs
- Remove the now-dead contains_secrets() function and its unit test from
  redaction.rs (per project rule: remove dead code, do not suppress)
- Add three async regression tests in hook.rs that each exercise a
  bypass-pattern secret type:
  test_process_hook_github_pat_is_redacted
  test_process_hook_slack_token_is_redacted
  test_process_hook_connection_string_is_redacted

Refs #2344
@AlexMikhalev AlexMikhalev merged commit 50285ad into main Jun 13, 2026
1 check passed
@AlexMikhalev AlexMikhalev deleted the reconcile/main branch June 13, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant