Repository navigation
fix(channels): authorize approval responders - #9574
JordanTheJet merged 21 commits into
Conversation
|
I reviewed PR #9574 at head 🔴 Blocking — Lark approval authorization is still tested below the production ingressThe new Neither production front door is exercised by this test:
Therefore the regression stays green if protobuf/event deserialization, webhook extraction, or either wrapper's short-circuiting regresses. The authorization helper's state transitions are covered, but the security decision is not yet proven at the Lark production boundary. Add a deterministic test through the real webhook or WebSocket wrapper (or a shared router that is invoked by both wrappers) with a production-shaped ✅ Resolved — Known approval replies no longer fall through
✅ Resolved — PR label metadata is synchronizedThe live PR labels and the labels listed in the current PR body match; the earlier stale-label concern does not remain. 🟢 What looks good — One shared authorization boundaryThe change keeps pending approval state as the source of truth, resolves the current peer allowlist at response time, binds responses to the originating destination, and retains pending entries after rejected responses so the legitimate operator can still answer. The adapter-specific identity handling is appropriately fail-closed: Telegram accepts either allowlisted username or numeric user ID, Matrix uses the canonical room ID, and Lark checks the card operator and chat ID. Validation
🤖 Automated review by ZeroClaw-Bot. Posted as a comment: not a formal approval and does not satisfy the branch review requirement. Reviewed |
Audacity88
left a comment
There was a problem hiding this comment.
@jstar0, I checked the automated review against current head 751a9135eb08. The production fall-through finding still applies, and the fix needs ingress-level regression coverage.
Rejected approval-shaped text can still fall through to ordinary agent dispatch because the shared resolver returns the same false result for “no pending token” and “pending token rejected.” The Slack and Matrix text paths continue normal message processing on that false result. The new tests call the resolver directly, so they do not prove that those rejected replies emit no ChannelMessage through the production ingress paths.
Please fix the fall-through, add the ingress regressions, resolve the current master conflict, and ping us when the PR is ready for re-review. If you disagree with the finding, reply on the thread with the production path or test evidence we should reconsider.
751a913 to
5240b43
Compare
#9423) - Carry operator-versus-runtime denial provenance through native channels, routed and fan-out approval, gateway WebSocket, RPC, and the runtime gate. - Keep genuine operator denials attributed to the user while returning neutral model-visible text for unavailable, unreachable, timed-out, and other fail-closed runtime outcomes. - Reject unknown Lark callback decisions without converting them into operator denials, and add cross-boundary regression coverage. Closes #9642. Related #9387 and #9574.
98db7cf to
d2e9c75
Compare
|
Rebased onto current |
* fix(security): redact Slack tokens in the leak detector (zeroclaw-labs#8918) Add Slack-specific leak-detector patterns for current bot, user, app, workflow, refresh, and rotated access-token formats. Keep static regex invariants explicit, constrain rotated-token matching to documented bot and user shapes, and cover benign dotted text to prevent false positives. Co-authored-by: CedricConday <[email protected]> * fix(parser): quote GLM curl URLs for POSIX shells (zeroclaw-labs#9444) Branch history (the effective landing diff is parser-only): - 5f97296 Inherited heartbeat-test foundation, already landed through zeroclaw-labs#9411 - a757999 fix(parser): quote GLM curl URLs for POSIX shells - 6bd492d Merge master after zeroclaw-labs#9411 landed - 33396ad Merge current master into the contributor branch * fix(config): default context_compression.enabled to false and warn on the inert surface (zeroclaw-labs#9299) - 480b605 fix(config): default context_compression.enabled to false and warn on the inert surface - 21e0ad1 style(config): reword issue refs to satisfy comment hygiene gate - b3d7852 fix(config): report cross-provider summary_model as inert instead of runtime-dispatched - 6dfb813 fix(config): stop directing compression warning to an inert field - d9b64c8 Merge branch 'master' into fix/9278-context-compression-default - 1b53281 docs(config): clarify inert compression contract - 9dbc974 Merge branch 'master' into fix/9278-context-compression-default * fix(config): keep unknown-property sentinel matching typed (zeroclaw-labs#9445) * fix(policy): retain actions when cutoff underflows (zeroclaw-labs#9448) - 852c22e fix(policy): retain actions when cutoff underflows * fix(runtime): reject non-file absolute shell paths (zeroclaw-labs#9441) * fix(infra): make JSONL session rewrites atomic (zeroclaw-labs#9689) - Stage complete JSONL rewrites in a same-directory temporary file, sync the new bytes, and replace the live session only after the rewrite succeeds. - Serialize in-process JSONL mutations across `SessionStore` instances with an intentional sessions-directory lock, including atomic final-message replacement. - Add failure-preservation, temporary-file cleanup, and concurrent append/update regression coverage. This guarantees atomic visibility, not cross-process coordination or parent-directory power-loss durability. Related zeroclaw-labs#9600 and zeroclaw-labs#9715. * fix(agent): stream-hash tool args in loop_detector to avoid per-call deep clone (zeroclaw-labs#8936) (zeroclaw-labs#8937) - c1d797f fix(agent): stream-hash tool args in loop_detector to avoid per-call deep clone - 5d6244d fix(agent): add legacy canonicalise equivalence oracle for streaming loop-detector hash - a04fefd fix(agent): preserve legacy numeric equivalence classes in streaming loop_detector hash - 65aa07a Merge branch 'master' into fix/8936-loop-detector-streaming-hash * fix(tools): stop ask_user hangs on wrong/structured-only channels (zeroclaw-labs#9452) - 8e2d3b0 fix(tools): stop ask_user hangs on wrong/structured-only channels - f8a34cd Merge remote-tracking branch 'upstream/master' into fix/zc-ask-user - bc7131c fix(tools): route escalate_to_human and fail honestly on undeliverable channels - 56cf572 Merge branch 'master' into fix/zc-ask-user - 094730f fix(tools): make alert_channels a real escalation fallback * fix(runtime): scope peer-agent turns to the recipient's cost context (zeroclaw-labs#9469) - ec8cdaa fix(runtime): scope peer-agent turns to the recipient's cost context (zeroclaw-labs#9373) - 10407c6 test(runtime): clarify peer budget scope - 6a7df6c test(runtime): cover peer-turn cost scope through the real execute() boundary - 839af30 Merge branch 'master' into fix/9373-peer-turn-cost-context * refactor(providers): share OAuth refresh retry control flow (zeroclaw-labs#9400) - f283ff7 refactor(providers): share OAuth refresh retry logic - 832905f Merge branch 'master' into codex/pr-draft-9162 - d87a1cd chore: merge origin/master to refresh CI base - c670144 Merge branch 'master' into codex/pr-draft-9162 - 78340d8 Merge branch 'master' into codex/pr-draft-9162 * feat(providers): carry model context window from the models.dev catalog (zeroclaw-labs#9347) - cfdd46d feat(providers): carry model context window from the models.dev catalog - 7ae2ea9 Merge branch 'master' into feat/model-context-window-from-catalog - 9ead667 Merge branch 'master' into feat/model-context-window-from-catalog * fix(config): expose workspace paths to config set (zeroclaw-labs#9616) - Expose `PathBuf` configuration fields as string-valued schema properties. - Let non-interactive `config set` materialize a missing agent alias and persist its workspace path. - Add schema and CLI coverage for setting, reading, clearing, and dynamically materializing workspace paths. * fix(log): preserve JSONL rows during schema migration (zeroclaw-labs#9449) - 4974fb8 fix(log): preserve JSONL rows during schema migration - eae9dde fix(log): make reload migration lossless - d56e0dc fix(log): retain ownership after shutdown timeout - 0d05b43 fix(log): preserve append boundary after migration - c270cb9 Merge origin/master into codex/log-migration-integrity * fix(runtime): stop reporting an unanswerable approval as a user denial (zeroclaw-labs#9423) - Carry operator-versus-runtime denial provenance through native channels, routed and fan-out approval, gateway WebSocket, RPC, and the runtime gate. - Keep genuine operator denials attributed to the user while returning neutral model-visible text for unavailable, unreachable, timed-out, and other fail-closed runtime outcomes. - Reject unknown Lark callback decisions without converting them into operator denials, and add cross-boundary regression coverage. Closes zeroclaw-labs#9642. Related zeroclaw-labs#9387 and zeroclaw-labs#9574. * fix(runtime): close run() agent-lifecycle bracket on every exit path (zeroclaw-labs#9490) - cdaaba9 fix(runtime): close run() agent-lifecycle bracket on every exit path - ae68327 Merge branch 'master' into fix/9374-run-lifecycle-guard * fix(log): adapt fork flush_for_test + sync_active_file to upstream error-reporting contract Upstream fb0ab6e changed Flush's ack type to Result<()> so flush failures propagate to the caller. The fork had previously: - simplified Flush(SyncSender<Result<()>>) to Flush(SyncSender<()>) - made flush_for_test swallow all errors and return Ok(()) - made sync_active_file swallow open_active_file errors Restored upstream semantics on all three so the migration tests pass: worker sends Result, flush_for_test propagates it, sync_active_file uses ? on open_active_file. Uses anyhow::Error::msg (not anyhow::anyhow!) to stay compatible with the fork's disallowed-macros clippy lint. Also fixes one clippy option_as_ref_deref from upstream 9695763 (zeroclaw-labs#9448) in policy.rs test. --------- Co-authored-by: Cedric Conday <[email protected]> Co-authored-by: Dan Gilles <[email protected]> Co-authored-by: Iftekhar Uddin <[email protected]> Co-authored-by: wangmiao0668000666 <[email protected]> Co-authored-by: Tidux <[email protected]> Co-authored-by: JordanTheJet <[email protected]> Co-authored-by: jmoneytech-stack <[email protected]> Co-authored-by: Jason Perlow <[email protected]> Co-authored-by: kckylechen1 <>
Audacity88
left a comment
There was a problem hiding this comment.
@jstar0, I re-reviewed current head d2e9c75c407db93843fa4ff8e34b8093421a34b3 against #9387. The earlier Slack and Matrix fall-through problem is fixed.
The 11-file, +1,212/-136 scope is broad but coherent: #9387 deliberately covers the same responder-authorization contract across four adapters, while the PR centralizes authorization and pending-state mutation in one shared resolver and leaves only transport-specific identity/envelope extraction in each channel. Splitting it would leave the security fix incomplete rather than produce cleaner ownership.
Two security-boundary issues remain.
✅ Resolved — Known approval responses no longer fall through
PendingApprovalResolution now distinguishes unknown tokens from rejected, resolved, and closed-receiver responses. Slack and Matrix suppress every known-token result, while Telegram and Lark consume their callback events before ordinary message dispatch. This addresses the blocker from my previous review.
🔴 Blocking — Authenticate Lark HTTP callbacks before trusting responder fields
listen_http validates the configured token only for the URL-verification challenge. Every ordinary callback proceeds to handle_card_action_ingress, which then trusts request-controlled operator.open_id, context.open_chat_id, approval_id, and decision when resolving a pending approval.
That means a forged request to the public callback endpoint can claim an allowlisted operator and originating chat and resolve a known pending approval. The general webhook weakness predates this PR, but this PR adds the approval-resolution path that makes those unauthenticated fields security-authoritative, so it directly bypasses the responder-authorization guarantee being added here.
Please authenticate the complete HTTP callback before routing it, using the official Lark verification/signature contract for this callback form and failing closed when authentication is absent or invalid. Preserve the raw request body and headers needed for that check, and add a regression proving an invalidly authenticated card action cannot consume pending state. Lark's official SDK performs this verification at the HTTP dispatch boundary before invoking application code.
🔴 Blocking — Cover the changed Lark and Slack production ingress wiring
The Lark regression manually extracts header.event_type and event, then calls handle_card_action_ingress directly. It therefore bypasses both the WebSocket decode/router and the Axum HTTP handler, so it would remain green if either production wrapper failed to authenticate, route, or short-circuit a card action.
Slack has the same remaining gap for Socket Mode: the polling listener regression is strong, but the separately changed interactive listener branch is covered only by parser unit tests. Those tests do not prove that the production listener connects the parsed responder and channel to authorization, retains rejected approvals, and suppresses approval envelopes from ordinary command dispatch.
A small production-owned full-envelope router shared by each transport and tested directly would be sufficient; live provider credentials are not required. For both changed paths, cover unauthorized and wrong-destination responses remaining pending, an authorized response resolving, and no ordinary ChannelMessage being emitted.
🟢 What looks good — Shared authorization stays fail-closed
The shared resolver checks authorization and destination before removal under one lock, so rejected responses remain available to the legitimate operator and concurrent responses cannot both resolve the same approval. The Matrix and Slack polling regressions exercise meaningful production boundaries.
Current-head required CI is green. I did not run additional local Cargo or live-provider validation for this review.
Review — PR #9574: authorize approval respondersHead reviewed: 0f6e665 I reviewed the complete current diff across the four channel adapters, the shared pending-approval resolver, the Lark configuration/dependency changes, the locale catalogues, the callers of the resolver, the current PR conversation and formal review history, and the linked issue #9387. The central authorization contract is now implemented coherently: pending approvals carry their originating destination, responder identity and destination are checked before resolution, known rejected tokens are suppressed from ordinary dispatch, and the current head restores the Matrix portion that was lost during the earlier merge conflict. ✅ Resolved — Matrix authorization was restored after the earlier merge conflictThe prior blocking review on head 900e8fb identified that the merge conflict had replaced Matrix with master's pre-fix implementation. The current diff again changes matrix.rs at the inbound handler and approval-registration sites, including room resolution before sending the approval and destination-aware resolution on sync ingress. The full four-adapter test run with an isolated configuration passed the Matrix production-shaped sync regression and the Matrix approval tests. I am not re-raising the settled merge-conflict finding. ✅ Resolved — Lark and Slack approval decisions now cross their production-owned ingress boundariesThe earlier Lark and Slack ingress findings are addressed on this head. 🔴 Blocking — Compare the plaintext Lark verification token in constant time
The repository already provides 🟡 Warning — Refresh the PR body's label snapshotThe PR body lists 🟢 What looks good — The shared resolver is fail-closed and preserves the operator's chance to answer
Validation
No live Telegram, Slack, Lark, or Matrix provider smoke was run because no third-party credentials were available; the deterministic tests above cover the changed ingress and authorization paths. Review dispositionRequest changes for the one blocking plaintext-token comparison. The warning is maintainer-owned metadata cleanup. Once the comparison uses the shared constant-time helper and the body label snapshot is refreshed, the current authorization implementation and validation evidence look ready for another review. |
|
@jstar0, current head |
…l-responder-authorization Signed-off-by: King Star <[email protected]> # Conflicts: # crates/zeroclaw-channels/Cargo.toml # crates/zeroclaw-channels/src/lark.rs # crates/zeroclaw-channels/src/telegram.rs
Signed-off-by: King Star <[email protected]>
|
Resolved the current Verification:
The branch is ready for maintainer re-review. |
IftekharUddin
left a comment
There was a problem hiding this comment.
Reviewed exact head 884fdf0e919aae36a12d15e71983f4270af2c35a across the shared pending-approval state transition and the Telegram, Slack, Matrix, and Lark ingress boundaries. The responder and destination binding is preserved on the current head, but the encrypted Lark webhook path introduces one security blocker.
🔴 Blocking — Authenticate encrypted webhooks before CBC decryption
handle_lark_http_event calls decrypt_lark_webhook_body before verify_lark_webhook_request. The decryptor accepts attacker-controlled AES-CBC/PKCS#7 ciphertext from the public callback endpoint, and the handler exposes distinguishable outcomes: invalid padding returns 400 invalid webhook payload, while padding-valid plaintext that is not JSON returns 400 invalid JSON payload (and valid JSON without authentication reaches the later 401). That creates a remote padding oracle before the raw-body signature is checked.
Please parse the outer envelope only far enough to select the authentication mode, verify the encrypted request's SHA-256(timestamp + nonce + encrypt_key + raw body) signature, and reject missing or invalid authentication before attempting CBC decryption. Add a regression that submits tampered encrypted envelopes and proves they are rejected at authentication without exposing decryption or parsing outcomes.
Can this be done in a follow up issue? No. The vulnerable code is introduced by this PR at a public security boundary; deferring it would ship an unauthenticated cryptographic oracle.
Blocker impact
- Blocker: Encrypted Lark webhook ciphertext is decrypted before its raw-body signature is authenticated.
- Why it matters: An unauthenticated remote caller can distinguish CBC padding from later parsing/authentication outcomes at the public webhook endpoint.
- If ignored: Repeated adaptive requests can turn the endpoint into a padding oracle against captured encrypted webhook payloads, undermining the confidentiality/integrity boundary the Encrypt Key is meant to provide.
- Can this be done in a follow up issue? No; the unsafe ordering is newly introduced here and must be corrected before this security change is approved.
| use axum::response::IntoResponse; | ||
|
|
||
| let decrypted_body = | ||
| match decrypt_lark_webhook_body(&body, state.channel.encrypt_key.as_deref()) { |
There was a problem hiding this comment.
This decrypts attacker-controlled AES-CBC/PKCS#7 ciphertext before the raw-body signature is verified. The handler then distinguishes invalid padding (invalid webhook payload) from padding-valid non-JSON (invalid JSON payload) and later authentication failure, exposing a remote padding oracle on the public callback endpoint. Authenticate encrypted envelopes against the exact raw body first, then decrypt only after that check succeeds.
Signed-off-by: King Star <[email protected]>
IftekharUddin
left a comment
There was a problem hiding this comment.
@jstar0, I independently re-reviewed exact head 1e4ddfd837f36eee835d20d72f3641a12ea2383a across the Telegram, Slack, Lark, and Matrix approval-response authorization paths, their factory wiring and live identity resolvers, the linked contracts, focused tests, and the complete human-authored review history.
The previous Lark blocker applied to stale head 884fdf0e919aae36a12d15e71983f4270af2c35a. This head authenticates the exact raw encrypted webhook body before any CBC/PKCS#7 decryption. The focused regression also proves that unauthenticated invalid-padding and padding-valid/non-JSON ciphertexts return the same rejection without resolving a pending approval, while a correctly signed encrypted callback succeeds. The other channel adapters retain the required responder and destination authorization and consume approval-shaped traffic without ordinary message dispatch.
I found no substantive correctness, security, compatibility, or source-of-truth blocker on this exact head.
|
@JordanTheJet @Audacity88 Exact-head CI is green on 1e4ddfd. The current exact-head review confirms the Matrix recovery remains intact, and encrypted Lark webhooks now authenticate the exact raw body before CBC decryption. Please re-review when convenient. |
Review — PR #9574: authorize approval respondersHead reviewed: 1e4ddfd Verdict: Request changes I reviewed the complete Take stock
🔴 Blocking — Register the Lark approval before exposing the card
This loses valid approval decisions on the exact Lark path this PR is securing. The existing Lark tests populate the map manually and do not exercise the send/callback interleaving, so they cannot catch this race. Register the pending state before the outbound send, remove it if sending fails only when it is still the same pending request, and attach the returned 🔴 Blocking — Compare the signed Lark digest without short-circuiting
Normalize the accepted signature representation and compare it with the shared constant-time helper or compare decoded digest bytes with a constant-time operation. Preserve the current fail-closed behavior for missing, malformed, or partial signature headers, and add coverage for altered prefixes and suffixes. The current altered-signature test establishes rejection but does not establish constant-time comparison. 🟡 Warning — Refresh the PR body's live label snapshotThe PR body lists the labels that were present when it was drafted, but the current live label set also contains ✅ Resolved — Encrypted Lark callbacks authenticate before decryptionThe current handler parses only the raw outer JSON needed to identify an encrypted envelope, verifies ✅ Resolved — Responder and destination checks are centralized at ingress boundariesThe shared resolver keeps the allowlist decision, destination comparison, and pending-map removal under one lock, retaining rejected approvals for the legitimate operator and suppressing known rejected tokens from ordinary dispatch. Telegram supplies the callback user's allowlisted username/numeric ID and chat ID, Matrix supplies the live sender and canonical room, and Slack supplies the interactive/polling user and channel IDs. The current Lark and Slack production-owned dispatchers, Matrix sync handler, and Telegram polling listener all retain the intended fail-closed routing. I am not re-raising the prior fall-through, Matrix restoration, Lark wrapper, or Slack Socket Mode findings. 🟢 What looks good — The four-channel security slice remains coherentThe shared pending-approval state transition is a good architectural boundary for #9387: transport-specific code extracts the provider identity and destination, while one resolver owns the check-before-remove behavior. The tests also verify that rejected known tokens remain available and do not become ordinary agent turns. The Lark raw-body authentication ordering in this head is materially safer than the preceding revision and is backed by an exact production-handler regression. Template and public-artifact checksThe PR body contains the required Summary, Testing, Security & Privacy Impact, Compatibility, Rollback, and Supersede Attribution sections. ValidationThe complete command output is preserved in
VerdictRequest changes. The shared authorization implementation and the encrypted-Lark authentication ordering are in good shape, but Lark can lose a legitimate approval during the card-send/registration race, and the signed webhook digest comparison is still variable-time. The label snapshot is a non-blocking public-artifact cleanup. I would be ready to re-review after the two blocking issues are fixed and the exact-head validation/body evidence is refreshed. Institutional findings consulted: |
Register the pending approval before the provider accepts the card so an early operator callback still resolves. Compare signed webhook digests with the shared constant-time helper after normalizing 64-hex input. Co-authored-by: Cursor <[email protected]>
|
Addressed the two current-head Lark blockers on exact head
The PR body Testing and label snapshot are refreshed for this head. @JordanTheJet @Audacity88 please re-review when convenient. |
JordanTheJet
left a comment
There was a problem hiding this comment.
Re-review of PR #9574
Head reviewed: cd61058
@jstar0 — re-review after the recovery push and the Lark hardening round. My 2026-08-14 request-changes had exactly one blocker: the post-approval master merge had resolved the matrix.rs conflict by taking master's side, silently deleting the Matrix quarter of the fix. That is fully repaired, and the branch has grown genuinely better since. This closes my request-changes.
Take stock
- My blocker is resolved below. @Audacity88's APPROVED from 812757e covered the original four-channel design; @IftekharUddin ran a fresh round on the Lark webhook surface (CHANGES_REQUESTED at 884fdf0 → APPROVED at 1e4ddfd). One commit landed after his approval — cd61058 — which I have reviewed directly below so no head goes unexamined.
- CI is fully green at this exact head (36 checks). MERGEABLE; the only blocking review state is mine, which this review replaces.
- The PR body is current and truthful again: the Matrix claims are true, the label snapshot matches the live set exactly, the validation section describes the new Lark tests specifically, and the rollback line names every commit including the newest.
✅ Resolved — The Matrix fix is restored, composed with #9911, and byte-different from master
crates/zeroclaw-channels/src/matrix.rs is back to carrying the fix: +232 lines against master, approvals routed through crate::util::resolve_pending_approval, and #9911's mention_only gating composed alongside it in the same file (the reply-parent fetch is even shared with the gate — cleaner than the two features merely coexisting). Both authorization regressions are present: pending_approval_requires_allowed_user_and_origin_room and sync_ingress_suppresses_rejected_approval_replies_and_delivers_authorized_one. The any-room-can-approve hole is closed again, and this time the body's claims about it are true.
✅ Resolved — The feature-gate side effect
fix(channels): align approval resolver feature gate (884fdf0) fixes the dead-code shape I flagged as the tell: the shared resolver's gate now matches its real consumer set, and the body documents the no-default-features build staying warning-clean without suppressions.
🟢 What looks good — The Lark round made the PR stronger than what was originally approved
The webhook surface @IftekharUddin pushed on is real security work: encrypted callbacks are authenticated before decryption (invalid-padding and padding-valid/non-JSON envelopes both return the same 401 before any decrypt work, preserving pending state), and the final commit replaces an eq_ignore_ascii_case signature comparison with a constant-time, fail-closed digest check that rejects wrong-length and non-hex input before the secret-bearing comparison. The same commit fixes a genuine race — the pending approval is now registered before the card send, so an operator reply that beats the send's return can still resolve, with send-failure cleanup removing the entry only if a concurrent callback hasn't consumed it. The transport-seam test proves exactly that interleaving.
Since that last commit landed after @IftekharUddin's approval, for the record: I read cd61058 in full — it is the constant-time comparison, the registration reordering, their tests, and nothing else.
🔵 Suggestion — Strip AI attribution from future commits
cd61058 carries a Co-authored-by: Cursor trailer; repository policy is no bot/AI attribution footers in commits. No need to rewrite pushed history — the squash body will be sanitized at merge time — just leave the trailer off future commits.
Validation
- Restoration verified structurally:
matrix.rsdiffed against both master (fix present) and the branch history (resolver, destination capture, mention gating, both tests). - Focused suites run locally at this exact head with the body's exact feature matrix (
--no-default-features --features channel-slack,channel-lark,channel-matrix,channel-telegram approval): 56 passed / 0 failed. - Exact-head hosted CI: 36 checks green. The
--no-default-featuresapproval matrix run is recorded in the body with tails.
Verdict
Approve. The merge accident is repaired with the composition done right, the side effect is fixed, and the Lark hardening added since is work I'd have asked for had I known to. Thank you for the careful recovery — and for the patience across three weeks of review rounds; the four-channel authorization boundary this lands is worth it. With @Audacity88's design approval, @IftekharUddin's webhook round, and this review, the PR has its coverage; I'll clear needs-author-action on posting.
Audacity88
left a comment
There was a problem hiding this comment.
@jstar0 I re-reviewed cd61058cfe1ab043d4d855961ce1520d078eaa9e, including the complete Lark delta since 1e4ddfd8 and the affected approval and authentication paths. The accepted four-channel scope in #9387 remains coherent, and the previously restored Matrix protection is intact.
I approve the current implementation. The two latest Lark production findings are fixed. There is one nonblocking warning about what the new race test actually proves.
All 37 displayed hosted checks pass. The focused approval and webhook test results are your reported local runs; hosted CI's explicit Lark selector does not run the two new tests. I did not run local tests or live-provider smokes.
✅ Resolved — The prior production blockers
The latest zeroclaw-reviewer report identified registration after sending and a short-circuiting signature comparison. I independently checked both repairs: pending state is now inserted before token retrieval or the card send, a successful send only attaches its message ID if the entry remains, and send errors remove the pending entry. An authorized callback during a successful in-flight send can therefore retain its decision. Signed digests now use the existing constant-time helper after validating and normalizing the 64-character hex representation.
@JordanTheJet's Matrix restoration finding stays resolved: the current handler checks the responder and canonical room before removing pending state. @IftekharUddin's encrypted-webhook finding also stays resolved: raw-body authentication precedes CBC decryption. The earlier rejected-token fall-through and production-ingress coverage repairs remain present. JordanTheJet has now approved this exact head and replaced his earlier CHANGES_REQUESTED review.
🟢 What looks good
The existing responder policy and stored destination still govern resolution. Rejected replies leave the request available to the legitimate operator, and consumed entries are not recreated when the outbound send finishes. The Lark repair preserves the distinction between an operator decision and a runtime denial.
🟡 Warning — The race test does not enforce the claimed ordering
This is nonblocking because the production code now structurally registers the request before sending. In request_approval_registers_before_send_so_early_callback_resolves, however, the response is delayed 800 ms while the callback waits up to two seconds for pending state. The old implementation could finish the send, register the request, and still satisfy every assertion. The test establishes eventual resolution, not callback-before-send-return.
An optional follow-up should hold the HTTP response behind an explicit barrier, deliver the callback after the request arrives, and require callback completion before releasing the response. The test description should reflect the evidence it currently provides.
With JordanTheJet’s exact-head approval and this re-review, the two independent Core Team approvals required by FND-003 are covered.
Review — PR #9574: authorize approval respondersHead reviewed: 6baf196 @jstar0, I reviewed the complete 13-file diff ( The implementation on this exact head is materially stronger than the earlier revisions. The shared authorization core now checks the live responder policy and originating destination before consuming pending state; rejected known tokens remain suppressed rather than falling through to ordinary dispatch; Lark authenticates the raw webhook before decrypting; and the Lark send/registration race and signed-digest comparison have been addressed. The four-adapter scope remains coherent for #9387, although this is appropriately a high-risk, size-L security change. Take stock
🔴 Blocking — The required rollback command does not roll back this PRThe live PR body at
That is not a complete rollback of the reviewed change. The non-merge commits in Because 🟡 Warning — Refresh the stale validation narrative against the exact headThe current body at line 32 says that hosted CI “will re-run” the workspace gates, but the exact-head check runs are already complete: 32 checks succeeded and 4 completed as skipped ( ✅ Resolved — The responder and destination authorization boundary is present on all four adaptersThe current Telegram callback path reads both username/numeric identity and callback chat ID before resolving; Slack covers polling and Socket Mode with the responder and channel extracted from the production envelopes; Matrix resolves and stores the canonical room ID and gates both sender and room; and Lark checks the operator identity and originating open chat. ✅ Resolved — The Lark webhook hardening and lifecycle repairs are retained on this head
🟢 What looks good — Shared fail-closed state transitions and production-boundary testsThe shared Template and public-artifact checks
ValidationCommands were run against exact head 6baf196 with
VerdictRequest changes for the incomplete required rollback procedure. I found no current-head code or security-boundary blocker in the implementation itself, and the exact-head hosted checks plus focused local suites are green. Please correct the rollback path and refresh the stale validation wording; after that, the current code and review coverage look ready for merge. Institutional finding recorded: |
zeroclaw-labs#9423) - Carry operator-versus-runtime denial provenance through native channels, routed and fan-out approval, gateway WebSocket, RPC, and the runtime gate. - Keep genuine operator denials attributed to the user while returning neutral model-visible text for unavailable, unreachable, timed-out, and other fail-closed runtime outcomes. - Reject unknown Lark callback decisions without converting them into operator denials, and add cross-boundary regression coverage. Closes zeroclaw-labs#9642. Related zeroclaw-labs#9387 and zeroclaw-labs#9574.
Port challenge verification from upstream aa6bc26 (zeroclaw-labs#9110) and signature authentication from e762ce5 (zeroclaw-labs#9574). Limit token-only authentication to plaintext setup challenges and enable Lark regressions in the channels leg. Refs #521
Summary
masterheader.tokento the configured Verification Token.message_idonly if that entry is still present, and remove it on send failure only when the same request remains so an early operator callback still resolves.getUpdates, Slack polling, Slack Socket Mode interactive envelopes, Matrix sync, and Lark's HTTP callback handler.encrypt_keyandverification_tokenat the HTTP ingress boundary; webhook mode now fails closed at startup when neither authentication setting is configured.bug,dependencies,channel,config,runtime,channel:slack,channel:telegram,channel:matrix,trusted contributor,channel:lark,domain:security,risk:high,size:LTesting (required)
How you can test (when useful)
masterand this branch.channel:telegram,channel:slack,channel:lark, andchannel:matrix.master(before): Matching approval actions or tokens can resolve without responder and destination binding; in affected text paths, a rejected known token can also be dispatched as an ordinary message.How I tested
ChannelMessage; the Slack tests drive both polling and Socket Mode interactive dispatch; the Matrix test sends timeline events through the registered sync handlers; and the Lark HTTP handler test verifies that invalid-padding and padding-valid/non-JSON encrypted envelopes both return the same401 invalid authenticationresponse before decryption, retain pending approval state, and do not affect a valid signed encrypted callback. The new Lark transport-seam test delays the send and verifies eventual Operator/Approve resolution, but it does not require the callback to complete before the send response returns. The new signature test accepts uppercase 64-hex digests and rejects prefix, suffix, truncated, and lengthened values through the constant-time helper. These paths verify live allowlist decisions, destination matching, retained pending state, webhook authentication, and dispatch suppression. I did not use live Telegram, Slack, Lark, or Matrix credentials.Security & Privacy Impact (required)
Yes, describe the risk and mitigation: Replies that previously resolved approvals despite missing responder or destination authorization are now rejected by design. Lark HTTP callbacks reject invalid provider authentication before decryption or approval routing and preserve the existing fail-closed approval checks.Compatibility (required)
encrypt_keyenables encrypted signed webhook delivery, while existingverification_tokenauthenticates plaintext callbacks and URL verification. Webhook mode requires at least one of these existing settings.Noor either surface/floor question isYes: No schema migration is required. Configure the intended operator in the existing peer allowlist, answer in the chat or room where the approval prompt was sent, and configure the existing Lark authentication setting that matches the provider callback mode.Rollback (required for medium/high-risk PRs)
git revert cd61058cf 1e4ddfd8 bdc2b4c5 6137335d 74cd45b2 ef173834 afb3f0f0 b7b47988; no data or configuration migration is required.Supersede Attribution (required only when
Supersedes #is used)N/A; this PR does not supersede another contribution.