← Back to Pull requests

Follow-up of #8754: Harden remote signing no op #11292

Merged
ViktorT-11 merged 5 files (253 lines) on Nov 05, 2026 18:43 UTC
View on GitHub
ViktorT-11 ViktorT-11 commented on Oct 05, 2026 12:16 UTC
Author

This is a follow-up of #8754 tracked at #10705.

This PR resolves point 7 of the follow-up comment, and ensures that we never create a no-op remote signer in case the node is configured to act as an outbound remote signer:
https://github.com/lightningnetwork/lnd/issues/10705#issuecomment-4932249182

Diff: 253 lines (+241 / -12) across 5 files Reviewer: yyforyongyu Review duration: 45026m
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.42) × (1 − Review Confidence (0.73)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 253 lines diff across 5 files
0.42
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.49 · 5 substantive comment(s)
0.49
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
73%
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.331
Real PR Conversation Timeline
23 items
github-actions[bot] github-actions[bot] commented on Oct 05, 2026 12:19 UTC
Bot

🔴 PR Severity: CRITICAL

files API | 3 files | 213 lines changed

<details>
<summary>🔴 <strong>Critical</strong> (1 file)</summary>

  • lnwallet/rpcwallet/remote_signer_client_builder.go - lnwallet/ wallet/signing code; builds the remote signer client and governs no-op remote signer behavior
  • </details>

    <details>
    <summary>🟡 <strong>Medium</strong> (1 file)</summary>

  • lncfg/remotesigner.go - lncfg/ configuration for the remote signer feature
  • </details>

    <details>
    <summary>🟢 <strong>Low</strong> (1 file)</summary>

  • lnwallet/rpcwallet/remote_signer_client_test.go - test-only change
  • </details>

    Analysis

    The highest-severity file touched is lnwallet/rpcwallet/remote_signer_client_builder.go, which falls under lnwallet/* (wallet operations/signing) and is classified CRITICAL. This PR hardens remote-signing logic to prevent silently creating a no-op remote signer when the node is configured as an outbound remote signer — a correctness issue in signing configuration that warrants expert review. File/line counts are well under the bump thresholds, so no further escalation applies.

    ---
    <sub>To override, add a severity-override-{critical,high,medium,low} label.</sub>
    <!-- pr-severity-bot -->

    TechLateef TechLateef commented on code on Oct 05, 2026 18:27 UTC
    Code Review
    lncfg/remotesigner.go:1
    @@ -161,9 +161,20 @@ func DefaultWatchOnlyNodeCfg() *WatchOnlyNode {
     	}
     }
     
    +// IsSignerNode returns true if the node has been configured to act as a remote
    +// signer node that connects to a watch-only node.
    +//
    +// NOTE: This is the single place that decides whether the outbound remote
    +// signer feature has been requested. Callers should use this rather than
    +// reading the configuration fields directly, so that when the feature graduates
    +// out of experimental mode only this function needs to change.
    +func (w *WatchOnlyNode) IsSignerNode() bool {

    Nit: Consider adding a nil check to (w *WatchOnlyNode) IsSignerNode():

    func (w *WatchOnlyNode) IsSignerNode() bool {
        if w == nil {
            return false
        }
    
        return w.ExperimentalEnable
    }
    

    While cfg.WatchOnlyNode is initialized in DefaultConfig(),guarding the receiver avoids a panic if WatchOnlyNode is ever left uninitialized or passed as nil in tests/callers.

    TechLateef TechLateef commented on Oct 05, 2026 18:29 UTC
    Reviewer

    Noticed one remaining call site in config.go that still reads ExperimentalEnable directly:

    https://github.com/lightningnetwork/lnd/blob/f3a8f4e8ae8237ff2b40e4724de45085170df962/config.go#L1927-L1935

    Could be nice to update that to cfg.WatchOnlyNode.IsSignerNode() as well to fully route all callers through the new helper.

    litbot-9000 litbot-9000 commented on Oct 12, 2026 19:33 UTC
    Contributor

    @viktort-11, remember to re-request review from reviewers when ready

    litbot-9000 litbot-9000 commented on Oct 19, 2026 19:46 UTC
    Contributor

    @viktort-11, remember to re-request review from reviewers when ready

    litbot-9000 litbot-9000 commented on Oct 26, 2026 19:48 UTC
    Contributor

    @viktort-11, remember to re-request review from reviewers when ready

    litbot-9000 litbot-9000 commented on Nov 02, 2026 19:51 UTC
    Contributor

    @viktort-11, remember to re-request review from reviewers when ready

    yyforyongyu yyforyongyu commented on code on Nov 03, 2026 13:17 UTC
    Code Review
    lncfg/remotesigner.go:1
    @@ -161,9 +161,20 @@ func DefaultWatchOnlyNodeCfg() *WatchOnlyNode {
     	}
     }
     
    +// IsSignerNode returns true if the node has been configured to act as a remote
    +// signer node that connects to a watch-only node.
    +//
    +// NOTE: This is the single place that decides whether the outbound remote
    +// signer feature has been requested. Callers should use this rather than
    +// reading the configuration fields directly, so that when the feature graduates
    +// out of experimental mode only this function needs to change.
    +func (w *WatchOnlyNode) IsSignerNode() bool {

    i dont think that's needed

    yyforyongyu yyforyongyu commented on code on Nov 03, 2026 13:17 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_builder.go:1
    @@ -42,16 +64,42 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
     		}
     	}
     
    +	// Collect the build tags of any required sub-server that isn't
    +	// available, so that we can name them specifically if the node did ask
    +	// to act as a remote signer.
    +	var missingTags []string
    +	if walletServer == nil {
    +		missingTags = append(missingTags, walletBuildTag)
    +	}
    +	if signerServer == nil {
    +		missingTags = append(missingTags, signerBuildTag)
    +	}
    +
     	// Check if we have all servers and if the configuration enables an
     	// outbound remote signer. If not, return a NoOpClient.
    -	if walletServer == nil || signerServer == nil {
    +	if len(missingTags) > 0 {
    +		// We cannot service any signing requests without these
    +		// sub-servers, so if the node was configured to act as a remote
    +		// signer, this is a misconfiguration we must surface instead of
    +		// silently ignoring it.
    +		if b.cfg.IsSignerNode() {
    +			return nil, fmt.Errorf("unable to act as a remote "+
    +				"signer node: lnd was built without the %s "+
    +				"sub-server(s), which are required to service "+
    +				"signing requests. Rebuild lnd with the %q "+
    +				"and %q build tags enabled (e.g. 'make build "+
    +				"rpc=1'), or use an official release build",

    this should be make build with-rpc=1. rpc=1 isn't read by the Makefile, so following this command still produces a binary without the required subservers. also update the assertion in TestRemoteSignerClientBuilderErrorNamesBuildInstructions.

    yyforyongyu yyforyongyu commented on code on Nov 03, 2026 13:17 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_test.go:1
    @@ -731,3 +732,150 @@ func (m *mockSignerServer) InjectDependencies(
     
     	return nil
     }
    +
    +// TestRemoteSignerClientBuilder tests that the RemoteSignerClientBuilder
    +// returns the correct client for every combination of the watch-only node
    +// configuration and the availability of the sub-servers that are required to
    +// service signing requests.
    +//
    +// The case that matters most is a node that has been configured to act as a
    +// remote signer while the required sub-servers are unavailable, i.e. lnd was
    +// built without the signrpc and/or walletrpc build tags. That must be a loud
    +// error, as a NoOpClient would leave the signer node running and reporting
    +// healthy while never connecting to the watch-only node.
    +func TestRemoteSignerClientBuilder(t *testing.T) {
    +	t.Parallel()
    +
    +	var (
    +		walletKitServer = &mockWalletKitServer{}
    +		signerServer    = &mockSignerServer{}
    +	)
    +
    +	tests := []struct {
    +		name string
    +
    +		// isSignerNode indicates if the node has been configured to act
    +		// as a remote signer node.
    +		isSignerNode bool
    +
    +		// subServers are the sub-servers that are passed to the
    +		// builder.
    +		subServers []lnrpc.SubServer
    +
    +		// expectedClient is the type of client we expect the builder to
    +		// return. It is nil if we expect the builder to error out.
    +		expectedClient RemoteSignerClient
    +
    +		// expectedErrContains are substrings that the returned error
    +		// must contain. It is empty if we expect no error.
    +		expectedErrContains []string
    +	}{
    +		{
    +			name:         "not a signer node, no sub-servers",
    +			isSignerNode: false,
    +			subServers:   nil,
    +
    +			// A node that isn't acting as a remote signer has no
    +			// use for the sub-servers, so their absence is
    +			// expected and must remain a no-op.
    +			expectedClient: &NoOpClient{},
    +		},
    +		{
    +			name:         "not a signer node, all sub-servers",
    +			isSignerNode: false,
    +			subServers: []lnrpc.SubServer{
    +				walletKitServer, signerServer,
    +			},
    +			expectedClient: &NoOpClient{},
    +		},
    +		{
    +			name:         "signer node, no sub-servers",
    +			isSignerNode: true,
    +			subServers:   nil,
    +
    +			// Both sub-servers are missing, so both build tags
    +			// should be named in the error.
    +			expectedErrContains: []string{
    +				"unable to act as a remote signer node",
    +				walletBuildTag,
    +				signerBuildTag,
    +			},
    +		},
    +		{
    +			name:         "signer node, only the walletkit server",
    +			isSignerNode: true,
    +			subServers:   []lnrpc.SubServer{walletKitServer},
    +
    +			// Only the signer sub-server is missing, so only that
    +			// build tag should be reported as missing.
    +			expectedErrContains: []string{
    +				"lnd was built without the " + signerBuildTag +
    +					" sub-server(s)",
    +			},
    +		},
    +		{
    +			name:         "signer node, only the signer server",
    +			isSignerNode: true,
    +			subServers:   []lnrpc.SubServer{signerServer},
    +			expectedErrContains: []string{
    +				"lnd was built without the " + walletBuildTag +
    +					" sub-server(s)",
    +			},
    +		},
    +		{
    +			name:         "signer node, all sub-servers",
    +			isSignerNode: true,
    +			subServers: []lnrpc.SubServer{
    +				walletKitServer, signerServer,
    +			},
    +			expectedClient: &OutboundClient{},
    +		},
    +	}
    +
    +	for _, test := range tests {
    +		t.Run(test.name, func(t *testing.T) {
    +			t.Parallel()
    +
    +			cfg := lncfg.DefaultWatchOnlyNodeCfg()
    +			cfg.ExperimentalEnable = test.isSignerNode
    +
    +			builder := NewRemoteSignerClientBuilder(cfg)
    +
    +			client, err := builder.Build(test.subServers)
    +
    +			if len(test.expectedErrContains) > 0 {
    +				require.Error(t, err)
    +				require.Nil(t, client)
    +
    +				for _, substr := range test.expectedErrContains {
    +					require.ErrorContains(t, err, substr)

    nit: can we use a sentinel error and require.ErrorIs here? the failure cases currently depend only on the diagnostic wording. wrap the sentinel in Build and check its identity here, keeping the substring checks for the missing tags and rebuild instructions.

    yyforyongyu yyforyongyu requested changes on Nov 03, 2026 13:19 UTC
    Changes Requested Reviewer

    One doc issue and one nit, otherwise good to go!

    saubyk saubyk commented on code on Nov 03, 2026 14:55 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_builder.go:1
    @@ -42,16 +64,42 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
     		}
     	}
     
    +	// Collect the build tags of any required sub-server that isn't
    +	// available, so that we can name them specifically if the node did ask
    +	// to act as a remote signer.
    +	var missingTags []string
    +	if walletServer == nil {
    +		missingTags = append(missingTags, walletBuildTag)
    +	}
    +	if signerServer == nil {
    +		missingTags = append(missingTags, signerBuildTag)
    +	}
    +
     	// Check if we have all servers and if the configuration enables an
     	// outbound remote signer. If not, return a NoOpClient.
    -	if walletServer == nil || signerServer == nil {
    +	if len(missingTags) > 0 {
    +		// We cannot service any signing requests without these
    +		// sub-servers, so if the node was configured to act as a remote
    +		// signer, this is a misconfiguration we must surface instead of
    +		// silently ignoring it.
    +		if b.cfg.IsSignerNode() {

    Point 7 of #10705 also asks about signer-side dependencies being unavailable, not just missing sub-servers. From what I can tell addDeps already fails loudly if a sub-server cannot get its dependencies, so this builder was the only reachable silent no-op path. Is that your read as well? If so, could the PR description (or the closing comment on #10705) say so explicitly, so we can treat item 7 as fully closed rather than half done?

    saubyk saubyk commented on code on Nov 03, 2026 14:55 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_builder.go:1
    @@ -42,16 +64,42 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
     		}
     	}
     
    +	// Collect the build tags of any required sub-server that isn't
    +	// available, so that we can name them specifically if the node did ask
    +	// to act as a remote signer.
    +	var missingTags []string
    +	if walletServer == nil {
    +		missingTags = append(missingTags, walletBuildTag)
    +	}
    +	if signerServer == nil {
    +		missingTags = append(missingTags, signerBuildTag)
    +	}
    +
     	// Check if we have all servers and if the configuration enables an
     	// outbound remote signer. If not, return a NoOpClient.
    -	if walletServer == nil || signerServer == nil {
    +	if len(missingTags) > 0 {
    +		// We cannot service any signing requests without these
    +		// sub-servers, so if the node was configured to act as a remote
    +		// signer, this is a misconfiguration we must surface instead of
    +		// silently ignoring it.
    +		if b.cfg.IsSignerNode() {
    +			return nil, fmt.Errorf("unable to act as a remote "+
    +				"signer node: lnd was built without the %s "+
    +				"sub-server(s), which are required to service "+
    +				"signing requests. Rebuild lnd with the %q "+
    +				"and %q build tags enabled (e.g. 'make build "+
    +				"rpc=1'), or use an official release build",

    Nice that the error now tells the operator about the build tags at runtime. docs/remote-signing.md does not mention anywhere that signer mode (watchonlynode.experimentalenable) needs the signrpc and walletrpc tags, so someone building from source only learns this after unlocking the wallet and watching lnd exit. Would it make sense to add a short note in the outbound signer section of the doc as part of this PR?

    saubyk saubyk commented on Nov 03, 2026 14:57 UTC
    Reviewer

    Only a few observations from my end (aided with Claude)

    ViktorT-11 ViktorT-11 commented on code on Nov 04, 2026 10:35 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_builder.go:1
    @@ -42,16 +64,42 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
     		}
     	}
     
    +	// Collect the build tags of any required sub-server that isn't
    +	// available, so that we can name them specifically if the node did ask
    +	// to act as a remote signer.
    +	var missingTags []string
    +	if walletServer == nil {
    +		missingTags = append(missingTags, walletBuildTag)
    +	}
    +	if signerServer == nil {
    +		missingTags = append(missingTags, signerBuildTag)
    +	}
    +
     	// Check if we have all servers and if the configuration enables an
     	// outbound remote signer. If not, return a NoOpClient.
    -	if walletServer == nil || signerServer == nil {
    +	if len(missingTags) > 0 {
    +		// We cannot service any signing requests without these
    +		// sub-servers, so if the node was configured to act as a remote
    +		// signer, this is a misconfiguration we must surface instead of
    +		// silently ignoring it.
    +		if b.cfg.IsSignerNode() {
    +			return nil, fmt.Errorf("unable to act as a remote "+
    +				"signer node: lnd was built without the %s "+
    +				"sub-server(s), which are required to service "+
    +				"signing requests. Rebuild lnd with the %q "+
    +				"and %q build tags enabled (e.g. 'make build "+
    +				"rpc=1'), or use an official release build",

    Good catch! Addressed.

    ViktorT-11 ViktorT-11 commented on code on Nov 04, 2026 10:40 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_builder.go:1
    @@ -42,16 +64,42 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
     		}
     	}
     
    +	// Collect the build tags of any required sub-server that isn't
    +	// available, so that we can name them specifically if the node did ask
    +	// to act as a remote signer.
    +	var missingTags []string
    +	if walletServer == nil {
    +		missingTags = append(missingTags, walletBuildTag)
    +	}
    +	if signerServer == nil {
    +		missingTags = append(missingTags, signerBuildTag)
    +	}
    +
     	// Check if we have all servers and if the configuration enables an
     	// outbound remote signer. If not, return a NoOpClient.
    -	if walletServer == nil || signerServer == nil {
    +	if len(missingTags) > 0 {
    +		// We cannot service any signing requests without these
    +		// sub-servers, so if the node was configured to act as a remote
    +		// signer, this is a misconfiguration we must surface instead of
    +		// silently ignoring it.
    +		if b.cfg.IsSignerNode() {

    Yes, your assumption is correct, addDeps will error. I'll edit the issue, so that it mentions only the sub-servers.

    ViktorT-11 ViktorT-11 commented on code on Nov 04, 2026 10:41 UTC
    Code Review
    lnwallet/rpcwallet/remote_signer_client_builder.go:1
    @@ -42,16 +64,42 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
     		}
     	}
     
    +	// Collect the build tags of any required sub-server that isn't
    +	// available, so that we can name them specifically if the node did ask
    +	// to act as a remote signer.
    +	var missingTags []string
    +	if walletServer == nil {
    +		missingTags = append(missingTags, walletBuildTag)
    +	}
    +	if signerServer == nil {
    +		missingTags = append(missingTags, signerBuildTag)
    +	}
    +
     	// Check if we have all servers and if the configuration enables an
     	// outbound remote signer. If not, return a NoOpClient.
    -	if walletServer == nil || signerServer == nil {
    +	if len(missingTags) > 0 {
    +		// We cannot service any signing requests without these
    +		// sub-servers, so if the node was configured to act as a remote
    +		// signer, this is a misconfiguration we must surface instead of
    +		// silently ignoring it.
    +		if b.cfg.IsSignerNode() {
    +			return nil, fmt.Errorf("unable to act as a remote "+
    +				"signer node: lnd was built without the %s "+
    +				"sub-server(s), which are required to service "+
    +				"signing requests. Rebuild lnd with the %q "+
    +				"and %q build tags enabled (e.g. 'make build "+
    +				"rpc=1'), or use an official release build",

    Added a paragraph for this in the docs/remote-signing.md doc 👍

    ViktorT-11 ViktorT-11 commented on Nov 04, 2026 10:42 UTC
    Author

    Thanks for the reviews! I've addressed your feedback :pray:

    yyforyongyu yyforyongyu approved these changes on Nov 04, 2026 11:20 UTC
    Approved Reviewer

    LGTM!

    saubyk saubyk approved these changes on Nov 04, 2026 15:03 UTC
    Approved Reviewer

    Ack

    ViktorT-11 ViktorT-11 commented on Nov 05, 2026 11:06 UTC
    Author

    Rebased on master

    ViktorT-11 ViktorT-11 commented on Nov 05, 2026 16:20 UTC
    Author

    Rebased on mater again

    Reviewers
    Assignees
    ViktorT-11 ViktorT-11
    Labels
    risk: low confidence: 73.4% 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: 42.0% (MEDIUM) · Higher = larger blast radius
    42.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: 73.4% · Lower = rushed or shallow review
    73.4%
    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: 11.2% · Safe to merge
    11.2%