← Back to Pull requests

macaroons: refresh the package README #11203

Open
unknown opened this pull request with 381 lines diff across 4 files
View on GitHub
unknown unknown commented on Sep 18, 2026 19:41 UTC
Author

Change Description

Depends on #11117. The ProtectorConstraint bullet below documents the constraint that PR adds, so this one should be merged after it.

macaroons/README.md has drifted from the code. This refreshes it. No code changes, documentation only.

Macaroons baked at startup. The README described only admin.macaroon, invoice.macaroon and readonly.macaroon. Five sub servers also bake one of their own on first startup when they are compiled in (router, signer, walletkit, chainnotifier, invoices), and four of those files can be pointed elsewhere with a command line option. They are now listed with the permissions they carry, along with what --stateless_init means for them: no file is written, and only the admin macaroon comes back over RPC.

Permission example. The invoice.macaroon example was missing onchain:read. It now matches invoicePermissions in rpcserver.go.

Constraints. The section stated that "there are currently two constraints implemented" and covered TimeoutConstraint and IPLockConstraint only. IPRangeLockConstraint and CustomConstraint have been around for several releases. The section now says what a constraint is (a first party caveat, which anyone holding the macaroon can append offline and which can only narrow what the macaroon allows), lists every one of them with the caveat condition it encodes, and points at config_builder.go, where the checkers for the lnd specific conditions are registered.

How constraints are applied. Adds examples for both bakemacaroon and constrainmacaroon, notes that --macaroontimeout is applied to every lncli call with a 60 second default as a basic anti-replay measure, and records that IPRangeLockConstraint is currently reachable only from Go code, since neither command registers a flag for it (#11127).

Protector constraint. Documents ProtectorConstraint from #11117 alongside the other four constraints, including that only the profile name travels in the macaroon while the rules are compiled into lnd, and points at docs/macaroons.md for the available profiles.

Obsolete section. Drops "Upgrading from v0.8.0-beta or earlier", which is about upgrades to a release that is now many years old.

Fixes gPRC in passing.

Steps to Test

Documentation only, so there is nothing to run. The claims can be checked against the code:

grep -rn "MacPath\|MacFilename" --include=.go lnrpc/ | grep -v _test for the sub server macaroon files and their path flags.
grep -n -A 25 "invoicePermissions = " rpcserver.go for the permission example.
ls macaroons/constraints.go and grep -n "func.Constraint" macaroons/.go for the four constraints.
grep -n "Checker" config_builder.go for where the checkers are registered.

The ProtectorConstraint bullet can only be checked against the #11117 branch, where the constraint lives in macaroons/protector.go and its checker is registered in config_builder.go next to the other three.

Diff: 381 lines (+285 / -96) across 4 files Reviewer: Lrifton92 Review duration: 105145m
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.50) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 381 lines diff across 4 files
0.50
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
44%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.356
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #11203"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 44.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 50.0% (MEDIUM) · Higher = larger blast radius
50.0%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 44.7% · Lower = rushed or shallow review
44.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 27.6% · Safe to merge
27.6%