What changed, and why it matters
This commit updates a core Lightning Network library (lightning-onion) to a new version that adds 'onion-messaging support.' It also adjusts LND's own code to match renamed constants and functions in that library. The change is presented as a routine dependency update, but because the library handles the encrypted routing packets that every Lightning payment uses, any change there can affect payment privacy and correctness. There is no direct evidence in the commit of a security bug or fix, and no vendor statement that this update is security-related.
Treat as a normal dependency update unless additional context shows the lightning-onion v1.3.0 release contains a security fix. Review the lightning-onion v1.3.0 release notes and diff for any security-relevant changes, run existing fuzz tests, and verify that the MaxRoutingPayloadSize constant and DecodeHopPayload behavior do not weaken payload-size enforcement or parsing robustness.
Security signals we found
Dependency update of a cryptographic/onion-routing library to a new minor version
API rename from MaxPayloadSize to MaxRoutingPayloadSize and introduction of DecodeHopPayload with tlvGuaranteed flag
Commit message frames change as feature addition ('onion-messaging support'), not a security fix
No CVE, advisory, or vendor security statement present in supplied materials
Evidence from the diff
The commit bumps github.com/lightningnetwork/lightning-onion from a pre-release pseudo-version (v1.2.1-0.20240815225420-8b40adf04ab9) to v1.3.0. LND code is updated to use the new API: sphinx.MaxPayloadSize is renamed to sphinx.MaxRoutingPayloadSize, and sphinx.HopPayload.Decode is replaced by sphinx.DecodeHopPayload returning *sphinx.HopPayload with a new tlvGuaranteed parameter. A fuzz test is updated accordingly. The commit message says the new version ‘includes onion-messaging support.’ Other go.mod/go.sum changes (blackfriday, go-md2man, a local actor replace directive) appear incidental.
Changed components
github.com/lightningnetwork/lightning-onion dependencyhtlcswitch/hop fuzz testsrouting/pathfind.go path-finding payload-size checksInspect captured patch +23 / −16
diff --git a/.golangci.yml b/.golangci.yml
index dc82da8..9359a10 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -160,6 +160,7 @@ linters:
- github.com/gogo/protobuf
- google.golang.org/protobuf
- github.com/lightningnetwork/lnd/sqldb
+ - github.com/lightningnetwork/lightning-onion
replace-local: true
gosec:
diff --git a/go.mod b/go.mod
index 67c1570..797a84f 100644
--- a/go.mod
+++ b/go.mod
@@ -32,7 +32,7 @@ require (
github.com/kkdai/bstream v1.0.0
github.com/lightninglabs/neutrino v0.16.1
github.com/lightninglabs/neutrino/cache v1.1.2
- github.com/lightningnetwork/lightning-onion v1.2.1-0.20240815225420-8b40adf04ab9
+ github.com/lightningnetwork/lightning-onion v1.3.0
github.com/lightningnetwork/lnd/cert v1.2.2
github.com/lightningnetwork/lnd/clock v1.1.1
github.com/lightningnetwork/lnd/fn/v2 v2.0.9
@@ -82,7 +82,7 @@ require (
github.com/containerd/continuity v0.3.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
- github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
+ github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/lru v1.1.2 // indirect
github.com/docker/cli v28.1.1+incompatible // indirect
@@ -148,8 +148,7 @@ require (
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
- github.com/russross/blackfriday/v2 v2.0.1 // indirect
- github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
+ github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.2 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.6 // indirect
@@ -202,6 +201,9 @@ require (
sigs.k8s.io/yaml v1.2.0 // indirect
)
+// TODO(gijs): remove once new actor package is released.
+replace github.com/lightningnetwork/lnd/actor => ./actor
+
// TODO(elle): remove once the gossip V2 sqldb changes have been made.
replace github.com/lightningnetwork/lnd/sqldb => ./sqldb
diff --git a/go.sum b/go.sum
index a3f1a3d..ec6540f 100644
--- a/go.sum
+++ b/go.sum
@@ -111,8 +111,8 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7
github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
-github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
-github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
+github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
+github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
@@ -368,8 +368,8 @@ github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3
github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo=
github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display h1:Y2WiPkBS/00EiEg0qp0FhehxnQfk3vv8U6Xt3nN+rTY=
github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
-github.com/lightningnetwork/lightning-onion v1.2.1-0.20240815225420-8b40adf04ab9 h1:6D3LrdagJweLLdFm1JNodZsBk6iU4TTsBBFLQ4yiXfI=
-github.com/lightningnetwork/lightning-onion v1.2.1-0.20240815225420-8b40adf04ab9/go.mod h1:EDqJ3MuZIbMq0QI1czTIKDJ/GS8S14RXPwapHw8cw6w=
+github.com/lightningnetwork/lightning-onion v1.3.0 h1:FqILgHjD6euc/Muo1VOzZ4+XDPuFnw6EYROBq0rR/5c=
+github.com/lightningnetwork/lightning-onion v1.3.0/go.mod h1:nP85zMHG7c0si/eHBbSQpuDCtnIXfSvFrK3tW6YWzmU=
github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI=
github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U=
github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0=
@@ -485,13 +485,13 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
-github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
-github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
diff --git a/htlcswitch/hop/fuzz_test.go b/htlcswitch/hop/fuzz_test.go
index e5c00b5..7cfc30a 100644
--- a/htlcswitch/hop/fuzz_test.go
+++ b/htlcswitch/hop/fuzz_test.go
@@ -39,21 +39,25 @@ func FuzzHopData(f *testing.F) {
func FuzzHopPayload(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
- if len(data) > sphinx.MaxPayloadSize {
+ if len(data) > sphinx.MaxRoutingPayloadSize {
return
}
r := bytes.NewReader(data)
- var hopPayload1, hopPayload2 sphinx.HopPayload
+ var hopPayload1, hopPayload2 *sphinx.HopPayload
+ tlvGuaranteed := false
- if err := hopPayload1.Decode(r); err != nil {
+ hopPayload1, err := sphinx.DecodeHopPayload(r, tlvGuaranteed)
+ if err != nil {
return
}
var b bytes.Buffer
require.NoError(t, hopPayload1.Encode(&b))
- require.NoError(t, hopPayload2.Decode(&b))
+
+ hopPayload2, err = sphinx.DecodeHopPayload(&b, tlvGuaranteed)
+ require.NoError(t, err)
require.Equal(t, hopPayload1, hopPayload2)
})
@@ -129,7 +133,7 @@ func FuzzPayloadIntermediateNoBlinding(f *testing.F) {
func fuzzPayload(f *testing.F, finalPayload, updateAddBlinded bool) {
f.Fuzz(func(t *testing.T, data []byte) {
- if len(data) > sphinx.MaxPayloadSize {
+ if len(data) > sphinx.MaxRoutingPayloadSize {
return
}
diff --git a/routing/pathfind.go b/routing/pathfind.go
index 97ce809..e2ae5d4 100644
--- a/routing/pathfind.go
+++ b/routing/pathfind.go
@@ -978,7 +978,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
routingInfoSize := toNodeDist.routingInfoSize + payloadSize
// Skip paths that would exceed the maximum routing info size.
- if routingInfoSize > sphinx.MaxPayloadSize {
+ if routingInfoSize > sphinx.MaxRoutingPayloadSize {
return
}
Why this scored 31/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.