Skip to content

Commit d23617b

Browse files
Revert "Improve authorization checks for CN app APIs (#2509)" (#3308)
This reverts commit 0e47bd9 / PR #2509 [ci] This is to de risk the (expedided) 0.5.4 release. We'll undo this merge right after 0.5.4 is cut. Signed-off-by: Martin Florian <martin.florian@digitalasset.com>
1 parent feac867 commit d23617b

File tree

42 files changed

+1682
-2434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1682
-2434
lines changed

apps/app/src/main/scala/org/lfdecentralizedtrust/splice/console/ScanAppReference.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import org.lfdecentralizedtrust.splice.codegen.java.splice.dsorules.{
5959
DsoRules_CloseVoteRequestResult,
6060
VoteRequest,
6161
}
62-
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.HttpSvOperatorAppClient
62+
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.HttpSvAdminAppClient
6363

6464
import scala.jdk.OptionConverters.*
6565
import java.time.Instant
@@ -674,7 +674,7 @@ abstract class ScanAppReference(
674674
): Contract[VoteRequest.ContractId, VoteRequest] = {
675675
consoleEnvironment.run {
676676
httpCommand(
677-
HttpSvOperatorAppClient.LookupVoteRequest(trackingCid)()
677+
HttpSvAdminAppClient.LookupVoteRequest(trackingCid)()
678678
)
679679
}
680680
}

apps/app/src/main/scala/org/lfdecentralizedtrust/splice/console/SvAppReference.scala

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ import org.lfdecentralizedtrust.splice.http.v0.definitions
2222
import org.lfdecentralizedtrust.splice.sv.{SvApp, SvAppBootstrap, SvAppClientConfig}
2323
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.{
2424
HttpSvAdminAppClient,
25-
HttpSvOperatorAppClient,
26-
HttpSvPublicAppClient,
25+
HttpSvAppClient,
2726
}
2827
import org.lfdecentralizedtrust.splice.sv.automation.{
2928
DsoDelegateBasedAutomationService,
30-
SvDsoAutomationService,
3129
SvSvAutomationService,
30+
SvDsoAutomationService,
3231
}
3332
import org.lfdecentralizedtrust.splice.sv.config.SvAppBackendConfig
3433
import org.lfdecentralizedtrust.splice.sv.migration.{DomainDataSnapshot, SynchronizerNodeIdentities}
@@ -55,51 +54,46 @@ abstract class SvAppReference(
5554
def onboardValidator(validator: PartyId, secret: String, contactPoint: String): Unit =
5655
consoleEnvironment.run {
5756
httpCommand(
58-
HttpSvPublicAppClient.OnboardValidator(
59-
validator,
60-
secret,
61-
BuildInfo.compiledVersion,
62-
contactPoint,
63-
)
57+
HttpSvAppClient.OnboardValidator(validator, secret, BuildInfo.compiledVersion, contactPoint)
6458
)
6559
}
6660

6761
def startSvOnboarding(token: String): Unit =
6862
consoleEnvironment.run {
69-
httpCommand(HttpSvPublicAppClient.StartSvOnboarding(token))
63+
httpCommand(HttpSvAppClient.StartSvOnboarding(token))
7064
}
7165

72-
def getSvOnboardingStatus(candidate: PartyId): HttpSvPublicAppClient.SvOnboardingStatus =
66+
def getSvOnboardingStatus(candidate: PartyId): HttpSvAppClient.SvOnboardingStatus =
7367
consoleEnvironment.run {
74-
httpCommand(HttpSvPublicAppClient.getSvOnboardingStatus(candidate.toProtoPrimitive))
68+
httpCommand(HttpSvAppClient.getSvOnboardingStatus(candidate.toProtoPrimitive))
7569
}
7670

77-
def getSvOnboardingStatus(candidate: String): HttpSvPublicAppClient.SvOnboardingStatus =
71+
def getSvOnboardingStatus(candidate: String): HttpSvAppClient.SvOnboardingStatus =
7872
consoleEnvironment.run {
79-
httpCommand(HttpSvPublicAppClient.getSvOnboardingStatus(candidate))
73+
httpCommand(HttpSvAppClient.getSvOnboardingStatus(candidate))
8074
}
8175

8276
@Help.Summary("Prepare a validator onboarding and return an onboarding secret (via client API)")
8377
def devNetOnboardValidatorPrepare(): String =
8478
consoleEnvironment.run {
85-
httpCommand(HttpSvPublicAppClient.DevNetOnboardValidatorPrepare())
79+
httpCommand(HttpSvAppClient.DevNetOnboardValidatorPrepare())
8680
}
8781

88-
def getDsoInfo(): HttpSvPublicAppClient.DsoInfo =
82+
def getDsoInfo(): HttpSvAppClient.DsoInfo =
8983
consoleEnvironment.run {
90-
httpCommand(HttpSvPublicAppClient.GetDsoInfo)
84+
httpCommand(HttpSvAppClient.GetDsoInfo)
9185
}
9286

9387
@Help.Summary("Get the CometBFT node status")
9488
def cometBftNodeStatus(): definitions.CometBftNodeStatusResponse =
9589
consoleEnvironment.run {
96-
httpCommand(HttpSvPublicAppClient.GetCometBftNodeStatus())
90+
httpCommand(HttpSvAppClient.GetCometBftNodeStatus())
9791
}
9892

9993
@Help.Summary("Get the CometBFT node dump")
10094
def cometBftNodeDebugDump(): definitions.CometBftNodeDumpResponse =
10195
consoleEnvironment.run {
102-
httpCommand(HttpSvOperatorAppClient.GetCometBftNodeDump())
96+
httpCommand(HttpSvAdminAppClient.GetCometBftNodeDump())
10397
}
10498

10599
@Help.Summary("Make a CometBFT Json RPC request")
@@ -109,17 +103,17 @@ abstract class SvAppReference(
109103
params: Map[String, io.circe.Json] = Map.empty,
110104
): definitions.CometBftJsonRpcResponse =
111105
consoleEnvironment.run {
112-
httpCommand(HttpSvPublicAppClient.CometBftJsonRpcRequest(id, method, params))
106+
httpCommand(HttpSvAppClient.CometBftJsonRpcRequest(id, method, params))
113107
}
114108

115109
def onboardSvPartyMigrationAuthorize(
116110
participantId: ParticipantId,
117111
candidateParty: PartyId,
118-
): HttpSvPublicAppClient.OnboardSvPartyMigrationAuthorizeResponse =
112+
): HttpSvAppClient.OnboardSvPartyMigrationAuthorizeResponse =
119113
consoleEnvironment
120114
.run {
121115
httpCommand(
122-
HttpSvPublicAppClient.OnboardSvPartyMigrationAuthorize(
116+
HttpSvAppClient.OnboardSvPartyMigrationAuthorize(
123117
participantId,
124118
candidateParty,
125119
)
@@ -183,7 +177,7 @@ abstract class SvAppReference(
183177
)(implicit tc: TraceContext): Unit = {
184178
consoleEnvironment.run {
185179
httpCommand(
186-
HttpSvOperatorAppClient.CreateVoteRequest(
180+
HttpSvAdminAppClient.CreateVoteRequest(
187181
requester,
188182
action,
189183
reasonUrl,
@@ -199,7 +193,7 @@ abstract class SvAppReference(
199193
def listVoteRequests(): Seq[Contract[VoteRequest.ContractId, VoteRequest]] = {
200194
consoleEnvironment.run {
201195
httpCommand(
202-
HttpSvOperatorAppClient.ListVoteRequests
196+
HttpSvAdminAppClient.ListVoteRequests
203197
)
204198
}
205199
}
@@ -221,7 +215,7 @@ abstract class SvAppReference(
221215
): Contract[VoteRequest.ContractId, VoteRequest] = {
222216
consoleEnvironment.run {
223217
httpCommand(
224-
HttpSvOperatorAppClient.LookupVoteRequest(trackingCid)()
218+
HttpSvAdminAppClient.LookupVoteRequest(trackingCid)()
225219
)
226220
}
227221
}
@@ -236,7 +230,7 @@ abstract class SvAppReference(
236230
): Seq[DsoRules_CloseVoteRequestResult] = {
237231
consoleEnvironment.run {
238232
httpCommand(
239-
HttpSvOperatorAppClient.ListVoteRequestResults(
233+
HttpSvAdminAppClient.ListVoteRequestResults(
240234
actionName,
241235
accepted,
242236
requester,
@@ -257,7 +251,7 @@ abstract class SvAppReference(
257251
): Unit = {
258252
consoleEnvironment.run {
259253
httpCommand(
260-
HttpSvOperatorAppClient.CastVote(trackingCid, isAccepted, reasonUrl, reasonDescription)
254+
HttpSvAdminAppClient.CastVote(trackingCid, isAccepted, reasonUrl, reasonDescription)
261255
)
262256
}
263257
}
@@ -347,31 +341,31 @@ class SvAppBackendReference(
347341
def listOngoingValidatorOnboardings(): Seq[ValidatorOnboarding] =
348342
consoleEnvironment.run {
349343
httpCommand(
350-
HttpSvOperatorAppClient.ListOngoingValidatorOnboardings
344+
HttpSvAdminAppClient.ListOngoingValidatorOnboardings
351345
)
352346
}
353347

354348
@Help.Summary("Prepare a validator onboarding and return an onboarding secret (via admin API)")
355349
def prepareValidatorOnboarding(expiresIn: FiniteDuration, partyHint: Option[String]): String =
356350
consoleEnvironment.run {
357351
httpCommand(
358-
HttpSvOperatorAppClient.PrepareValidatorOnboarding(expiresIn, partyHint)
352+
HttpSvAdminAppClient.PrepareValidatorOnboarding(expiresIn, partyHint)
359353
)
360354
}
361355

362356
@Help.Summary("Update CC price vote (via admin API)")
363357
def updateAmuletPriceVote(amuletPrice: BigDecimal): Unit =
364358
consoleEnvironment.run {
365359
httpCommand(
366-
HttpSvOperatorAppClient.UpdateAmuletPriceVote(amuletPrice)
360+
HttpSvAdminAppClient.UpdateAmuletPriceVote(amuletPrice)
367361
)
368362
}
369363

370364
@Help.Summary("List CC price vote (via admin API)")
371365
def listAmuletPriceVotes(): Seq[Contract[cp.AmuletPriceVote.ContractId, cp.AmuletPriceVote]] = {
372366
consoleEnvironment.run {
373367
httpCommand(
374-
HttpSvOperatorAppClient.ListAmuletPriceVotes
368+
HttpSvAdminAppClient.ListAmuletPriceVotes
375369
)
376370
}
377371
}
@@ -380,27 +374,27 @@ class SvAppBackendReference(
380374
def listOpenMiningRounds(): Seq[Contract[OpenMiningRound.ContractId, OpenMiningRound]] = {
381375
consoleEnvironment.run {
382376
httpCommand(
383-
HttpSvOperatorAppClient.ListOpenMiningRounds
377+
HttpSvAdminAppClient.ListOpenMiningRounds
384378
)
385379
}
386380
}
387381

388382
@Help.Summary("Get the CometBFT node debug dump")
389383
def cometBftNodeDump(): definitions.CometBftNodeDumpResponse =
390384
consoleEnvironment.run {
391-
httpCommand(HttpSvOperatorAppClient.GetCometBftNodeDump())
385+
httpCommand(HttpSvAdminAppClient.GetCometBftNodeDump())
392386
}
393387

394388
@Help.Summary("Get the sequencer node status")
395389
def sequencerNodeStatus(): NodeStatus[SpliceStatus] =
396390
consoleEnvironment.run {
397-
httpCommand(HttpSvOperatorAppClient.GetSequencerNodeStatus())
391+
httpCommand(HttpSvAdminAppClient.GetSequencerNodeStatus())
398392
}
399393

400394
@Help.Summary("Get the mediator node status")
401395
def mediatorNodeStatus(): NodeStatus[SpliceStatus] =
402396
consoleEnvironment.run {
403-
httpCommand(HttpSvOperatorAppClient.GetMediatorNodeStatus())
397+
httpCommand(HttpSvAdminAppClient.GetMediatorNodeStatus())
404398
}
405399

406400
/** Remote participant this sv app is configured to interact with. */

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/BftScanConnectionIntegrationTest.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ class BftScanConnectionIntegrationTest
113113
)
114114

115115
aliceValidatorBackend.startSync()
116-
onboardWalletUser(aliceValidatorWalletClient, aliceValidatorBackend)
117-
val walletUserToken =
118-
OAuth2BearerToken(aliceValidatorWalletClient.token.valueOrFail("No token found"))
119116

120117
val fakeCid = new TransferInstruction.ContractId("00" + s"01" * 31 + "42")
121118

@@ -140,7 +137,11 @@ class BftScanConnectionIntegrationTest
140137
.getTransferInstructionAcceptContext(
141138
fakeCid.contractId,
142139
GetChoiceContextRequest(None),
143-
List(Authorization(walletUserToken)),
140+
List(
141+
Authorization(
142+
OAuth2BearerToken(aliceValidatorBackend.token.valueOrFail("No token found"))
143+
)
144+
),
144145
)
145146
.value
146147
.futureValue
@@ -162,7 +163,11 @@ class BftScanConnectionIntegrationTest
162163
walletClient
163164
.acceptTokenStandardTransfer(
164165
fakeCid.contractId,
165-
List(Authorization(walletUserToken)),
166+
List(
167+
Authorization(
168+
OAuth2BearerToken(aliceValidatorBackend.token.valueOrFail("No token found"))
169+
)
170+
),
166171
)
167172
.value
168173
.futureValue

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/ScanIntegrationTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.{
3232
}
3333
import org.lfdecentralizedtrust.splice.scan.config.BftSequencerConfig
3434
import org.lfdecentralizedtrust.splice.store.Limit
35-
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.HttpSvPublicAppClient
35+
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.HttpSvAppClient
3636
import org.lfdecentralizedtrust.splice.sv.automation.delegatebased.{
3737
AdvanceOpenMiningRoundTrigger,
3838
ExpireIssuingMiningRoundTrigger,
@@ -111,7 +111,7 @@ class ScanIntegrationTest extends IntegrationTest with WalletTestUtil with TimeT
111111
"return dso info same as the sv app" in { implicit env =>
112112
val scan = sv1ScanBackend.getDsoInfo()
113113
inside(sv1Backend.getDsoInfo()) {
114-
case HttpSvPublicAppClient.DsoInfo(
114+
case HttpSvAppClient.DsoInfo(
115115
svUser,
116116
svParty,
117117
dsoParty,

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/SvOnboardingAddlIntegrationTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.lfdecentralizedtrust.splice.sv.util.{SvOnboardingToken, SvUtil}
1111
import com.digitalasset.canton.sequencing.GrpcSequencerConnection
1212

1313
import scala.jdk.OptionConverters.*
14-
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.HttpSvPublicAppClient.SvOnboardingStatus
14+
import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.HttpSvAppClient.SvOnboardingStatus
1515
import org.lfdecentralizedtrust.splice.util.{SvTestUtil, WalletTestUtil}
1616
import com.digitalasset.canton.logging.SuppressionRule
1717
import com.digitalasset.canton.topology.transaction.ParticipantPermission

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/SvOnboardingIntegrationTest.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ class SvOnboardingIntegrationTest extends SvIntegrationTestBase {
5858
.singleRequest(registerGet.withHeaders(tokenHeader(invalidUserToken)))
5959
.futureValue
6060
responseForInvalidUser.status should be(StatusCodes.Forbidden)
61-
responseForInvalidUser.entity.getContentType().toString should be(
62-
"application/json"
63-
)
61+
responseForInvalidUser.entity.getContentType().toString should be("application/json")
6462
},
6563
_.warningMessage should include(
6664
"Authorization Failed"

0 commit comments

Comments
 (0)