Skip to content

Commit 652e8e5

Browse files
committed
rpc_proxy: always allow Proxy calls
1 parent 88bd163 commit 652e8e5

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
@@ -577,8 +577,8 @@ func (p *rpcProxy) convertSuperMacaroon(ctx context.Context, macHex string,
577577
// checkSubSystemStarted checks if the subsystem responsible for handling the
578578
// given URI has started.
579579
func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
580-
// A request to Lit's status server is always allowed.
581-
if isStatusReq(requestURI) {
580+
// A request to Lit's status and proxy services is always allowed.
581+
if isStatusReq(requestURI) || isProxyReq(requestURI) {
582582
return nil
583583
}
584584

@@ -645,3 +645,11 @@ func isStatusReq(uri string) bool {
645645
uri, fmt.Sprintf("/%s", litrpc.Status_ServiceDesc.ServiceName),
646646
)
647647
}
648+
649+
// isProxyReq returns true if the given request is intended for the litrpc.Proxy
650+
// service.
651+
func isProxyReq(uri string) bool {
652+
return strings.HasPrefix(
653+
uri, fmt.Sprintf("/%s", litrpc.Proxy_ServiceDesc.ServiceName),
654+
)
655+
}

0 commit comments

Comments
 (0)