Skip to content

[codex] require loop:out for InstantOut#6

Closed
hieblmi wants to merge 8 commits into
masterfrom
fix-instantout-perms
Closed

[codex] require loop:out for InstantOut#6
hieblmi wants to merge 8 commits into
masterfrom
fix-instantout-perms

Conversation

@hieblmi
Copy link
Copy Markdown
Owner

@hieblmi hieblmi commented May 28, 2026

Summary

  • Require loop:out in addition to swap:execute for /looprpc.SwapClient/InstantOut.
  • Add a regression test for the InstantOut macaroon requirements.

Why

InstantOut can now accept dest_addr and use it as the on-chain sweep destination for reservation funds. That makes it an externally directed loop-out spend path, so a macaroon with only swap:execute should not be able to redirect those funds.

Requiring loop:out aligns InstantOut with LoopOut's authorization boundary. Existing clients remain wire-compatible; the intended behavior change is that narrowly scoped macaroons must include loop:out before they can start InstantOut.

Validation

  • go test -count=1 . (from looprpc)
  • go test -count=1 ./loopd

hieblmi added 8 commits May 27, 2026 11:49
Server-supplied nonces and partial signatures are consumed by the static address loop-in and withdrawal MuSig2 signing paths. Reject nil signing info, wrong nonce lengths, and wrong partial signature lengths before registering nonces or combining signatures, so malformed responses cannot be silently zero-padded into signing attempts.

Add withdrawal coverage for nil and malformed server signing data.
The cooperative batch sweep path receives a server nonce and partial signature before constructing a keyspend witness. Validate both byte slice lengths before registering the nonce or combining signatures, so malformed server responses fail explicitly instead of being zero-padded into fixed-size MuSig2 buffers.

Update batcher test helpers to return size-correct placeholder signing data under the stricter validation.
Loop-in and loop-out responses carry compressed server public keys that are copied into fixed-size fields and later used for HTLC construction. Validate the length and parse each compressed key before storing it, and validate the MuSig2 loop-in receiver internal key as well.

This turns short or unparsable server keys into explicit errors instead of silently zero-padding short responses or accepting an invalid internal key. Update root test mocks to return size-correct MuSig2 signing data under the stricter checks.
InstantOut can now accept a caller-provided destination address and use it as the on-chain sweep target for reservation funds. That makes it an externally directed loop-out spend path, so a swap:execute-only macaroon should not be sufficient.

Require the same loop:out authority used by LoopOut and add a regression test so the method cannot drift back to swap:execute-only authorization.
@hieblmi hieblmi closed this May 28, 2026
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