Skip to content

Commit 8a2ae88

Browse files
committed
rpc_proxy: always allow Proxy calls
1 parent a3a2c85 commit 8a2ae88

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

itest/litd_mode_integrated_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ var (
196196
restWebURI string
197197
restPOST bool
198198
canDisable bool
199+
litOnly bool
199200
}{{
200201
name: "lnrpc",
201202
macaroonFn: lndMacaroonFn,
@@ -292,6 +293,7 @@ var (
292293
allowedThroughLNC: false,
293294
grpcWebURI: "/litrpc.Proxy/GetInfo",
294295
restWebURI: "/v1/proxy/info",
296+
litOnly: true,
295297
}}
296298

297299
// customURIs is a map of endpoint URIs that we want to allow via a
@@ -416,7 +418,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
416418
endpoint.macaroonFn(cfg),
417419
endpoint.requestFn,
418420
endpoint.successPattern,
419-
endpointDisabled,
421+
endpointDisabled || endpoint.litOnly,
420422
"Unimplemented desc = unknown service",
421423
)
422424
})
@@ -447,7 +449,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
447449
ttt, cfg.RPCAddr(), cfg.TLSCertPath,
448450
cfg.UIPassword, endpoint.requestFn,
449451
true, endpoint.successPattern,
450-
endpointDisabled,
452+
endpointDisabled || endpoint.litOnly,
451453
"Unimplemented desc = unknown service",
452454
)
453455
})
@@ -516,7 +518,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
516518
superMacFile,
517519
endpoint.requestFn,
518520
endpoint.successPattern,
519-
endpointDisabled,
521+
endpointDisabled || endpoint.litOnly,
520522
"Unimplemented desc = unknown service",
521523
)
522524
})

rpc_proxy.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ func (p *rpcProxy) convertSuperMacaroon(ctx context.Context, macHex string,
607607
// checkSubSystemStarted checks if the subsystem responsible for handling the
608608
// given URI has started.
609609
func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
610-
// A request to Lit's status server is always allowed.
611-
if isStatusReq(requestURI) {
610+
// A request to Lit's status and proxy services is always allowed.
611+
if isStatusReq(requestURI) || isProxyReq(requestURI) {
612612
return nil
613613
}
614614

@@ -675,3 +675,11 @@ func isStatusReq(uri string) bool {
675675
uri, fmt.Sprintf("/%s", litrpc.Status_ServiceDesc.ServiceName),
676676
)
677677
}
678+
679+
// isProxyReq returns true if the given request is intended for the litrpc.Proxy
680+
// service.
681+
func isProxyReq(uri string) bool {
682+
return strings.HasPrefix(
683+
uri, fmt.Sprintf("/%s", litrpc.Proxy_ServiceDesc.ServiceName),
684+
)
685+
}

0 commit comments

Comments
 (0)