Skip to content

require loop:out perms for InstantOut#1149

Open
hieblmi wants to merge 1 commit into
lightninglabs:masterfrom
hieblmi:fix-instantout-perms
Open

require loop:out perms for InstantOut#1149
hieblmi wants to merge 1 commit into
lightninglabs:masterfrom
hieblmi:fix-instantout-perms

Conversation

@hieblmi
Copy link
Copy Markdown
Collaborator

@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 hieblmi changed the title [codex] require loop:out for InstantOut require loop:out perms for InstantOut May 28, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the security posture of the InstantOut RPC by mandating additional permissions for its execution. By requiring the loop:out permission, the system ensures that only authorized clients can perform externally directed loop-out operations. The changes also include a suite of improvements to the codebase, including standardized public key parsing, more robust validation for MuSig2 signing data, and various documentation and typo fixes across the project.

Highlights

  • Security Enhancement: Updated the InstantOut RPC method to require both swap:execute and loop:out permissions, strengthening the authorization boundary for externally directed spends.
  • Regression Testing: Added a new test file to verify that the InstantOut RPC correctly enforces the updated macaroon permission requirements.
  • Code Quality and Refactoring: Refactored server public key parsing into a shared helper function and improved MuSig2 signing data validation across multiple components and tests.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves MuSig2 signing validation, adds permission checks, refactors server public key parsing, and fixes various typos across the codebase. Specifically, it introduces length and nil checks for MuSig2 nonces and signatures, adds the loop:out permission requirement to the InstantOut RPC endpoint, and updates mock signing data in tests. A review comment highlights a potential issue in staticaddr/withdraw/manager.go where a missing key in depositsToIdx could lead to silent data corruption by defaulting to index 0; verifying the key's existence before usage is recommended.

Comment thread staticaddr/withdraw/manager.go
@hieblmi hieblmi marked this pull request as ready for review May 29, 2026 10:34
@hieblmi hieblmi force-pushed the fix-instantout-perms branch from 5e258b6 to 48f5ce2 Compare May 29, 2026 10:34
@hieblmi hieblmi closed this May 29, 2026
@hieblmi hieblmi force-pushed the fix-instantout-perms branch from 48f5ce2 to e0e1da5 Compare May 29, 2026 11:01
@hieblmi hieblmi reopened this May 29, 2026
@hieblmi hieblmi requested a review from starius May 29, 2026 11:29
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