-
Notifications
You must be signed in to change notification settings - Fork 44
Improve authorization checks for CN app APIs #2509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
270cfc4
ad5bb4b
32257aa
f81eac2
f66bfe8
cd8bdc8
fe92b4e
079d5dd
47a27ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,12 +22,13 @@ import org.lfdecentralizedtrust.splice.http.v0.definitions | |
| import org.lfdecentralizedtrust.splice.sv.{SvApp, SvAppBootstrap, SvAppClientConfig} | ||
| import org.lfdecentralizedtrust.splice.sv.admin.api.client.commands.{ | ||
| HttpSvAdminAppClient, | ||
| HttpSvAppClient, | ||
| HttpSvOperatorAppClient, | ||
| HttpSvPublicAppClient, | ||
| } | ||
| import org.lfdecentralizedtrust.splice.sv.automation.{ | ||
| DsoDelegateBasedAutomationService, | ||
| SvSvAutomationService, | ||
| SvDsoAutomationService, | ||
| SvSvAutomationService, | ||
| } | ||
| import org.lfdecentralizedtrust.splice.sv.config.SvAppBackendConfig | ||
| import org.lfdecentralizedtrust.splice.sv.migration.{DomainDataSnapshot, SynchronizerNodeIdentities} | ||
|
|
@@ -54,46 +55,51 @@ abstract class SvAppReference( | |
| def onboardValidator(validator: PartyId, secret: String, contactPoint: String): Unit = | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAppClient.OnboardValidator(validator, secret, BuildInfo.compiledVersion, contactPoint) | ||
| HttpSvPublicAppClient.OnboardValidator( | ||
| validator, | ||
| secret, | ||
| BuildInfo.compiledVersion, | ||
| contactPoint, | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| def startSvOnboarding(token: String): Unit = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.StartSvOnboarding(token)) | ||
| httpCommand(HttpSvPublicAppClient.StartSvOnboarding(token)) | ||
| } | ||
|
|
||
| def getSvOnboardingStatus(candidate: PartyId): HttpSvAppClient.SvOnboardingStatus = | ||
| def getSvOnboardingStatus(candidate: PartyId): HttpSvPublicAppClient.SvOnboardingStatus = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.getSvOnboardingStatus(candidate.toProtoPrimitive)) | ||
| httpCommand(HttpSvPublicAppClient.getSvOnboardingStatus(candidate.toProtoPrimitive)) | ||
| } | ||
|
|
||
| def getSvOnboardingStatus(candidate: String): HttpSvAppClient.SvOnboardingStatus = | ||
| def getSvOnboardingStatus(candidate: String): HttpSvPublicAppClient.SvOnboardingStatus = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.getSvOnboardingStatus(candidate)) | ||
| httpCommand(HttpSvPublicAppClient.getSvOnboardingStatus(candidate)) | ||
| } | ||
|
|
||
| @Help.Summary("Prepare a validator onboarding and return an onboarding secret (via client API)") | ||
| def devNetOnboardValidatorPrepare(): String = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.DevNetOnboardValidatorPrepare()) | ||
| httpCommand(HttpSvPublicAppClient.DevNetOnboardValidatorPrepare()) | ||
| } | ||
|
|
||
| def getDsoInfo(): HttpSvAppClient.DsoInfo = | ||
| def getDsoInfo(): HttpSvPublicAppClient.DsoInfo = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.GetDsoInfo) | ||
| httpCommand(HttpSvPublicAppClient.GetDsoInfo) | ||
| } | ||
|
|
||
| @Help.Summary("Get the CometBFT node status") | ||
| def cometBftNodeStatus(): definitions.CometBftNodeStatusResponse = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.GetCometBftNodeStatus()) | ||
| httpCommand(HttpSvPublicAppClient.GetCometBftNodeStatus()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is the node status public? (just curious) |
||
| } | ||
|
|
||
| @Help.Summary("Get the CometBFT node dump") | ||
| def cometBftNodeDebugDump(): definitions.CometBftNodeDumpResponse = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAdminAppClient.GetCometBftNodeDump()) | ||
| httpCommand(HttpSvOperatorAppClient.GetCometBftNodeDump()) | ||
| } | ||
|
|
||
| @Help.Summary("Make a CometBFT Json RPC request") | ||
|
|
@@ -103,17 +109,17 @@ abstract class SvAppReference( | |
| params: Map[String, io.circe.Json] = Map.empty, | ||
| ): definitions.CometBftJsonRpcResponse = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAppClient.CometBftJsonRpcRequest(id, method, params)) | ||
| httpCommand(HttpSvPublicAppClient.CometBftJsonRpcRequest(id, method, params)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also seems strange to be public? |
||
| } | ||
|
|
||
| def onboardSvPartyMigrationAuthorize( | ||
| participantId: ParticipantId, | ||
| candidateParty: PartyId, | ||
| ): HttpSvAppClient.OnboardSvPartyMigrationAuthorizeResponse = | ||
| ): HttpSvPublicAppClient.OnboardSvPartyMigrationAuthorizeResponse = | ||
| consoleEnvironment | ||
| .run { | ||
| httpCommand( | ||
| HttpSvAppClient.OnboardSvPartyMigrationAuthorize( | ||
| HttpSvPublicAppClient.OnboardSvPartyMigrationAuthorize( | ||
| participantId, | ||
| candidateParty, | ||
| ) | ||
|
|
@@ -174,7 +180,7 @@ abstract class SvAppReference( | |
| )(implicit tc: TraceContext): Unit = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.CreateVoteRequest( | ||
| HttpSvOperatorAppClient.CreateVoteRequest( | ||
| requester, | ||
| action, | ||
| reasonUrl, | ||
|
|
@@ -190,7 +196,7 @@ abstract class SvAppReference( | |
| def listVoteRequests(): Seq[Contract[VoteRequest.ContractId, VoteRequest]] = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.ListVoteRequests | ||
| HttpSvOperatorAppClient.ListVoteRequests | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -212,7 +218,7 @@ abstract class SvAppReference( | |
| ): Contract[VoteRequest.ContractId, VoteRequest] = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.LookupVoteRequest(trackingCid)() | ||
| HttpSvOperatorAppClient.LookupVoteRequest(trackingCid)() | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -227,7 +233,7 @@ abstract class SvAppReference( | |
| ): Seq[DsoRules_CloseVoteRequestResult] = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.ListVoteRequestResults( | ||
| HttpSvOperatorAppClient.ListVoteRequestResults( | ||
| actionName, | ||
| accepted, | ||
| requester, | ||
|
|
@@ -248,7 +254,7 @@ abstract class SvAppReference( | |
| ): Unit = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.CastVote(trackingCid, isAccepted, reasonUrl, reasonDescription) | ||
| HttpSvOperatorAppClient.CastVote(trackingCid, isAccepted, reasonUrl, reasonDescription) | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -338,31 +344,31 @@ class SvAppBackendReference( | |
| def listOngoingValidatorOnboardings(): Seq[ValidatorOnboarding] = | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.ListOngoingValidatorOnboardings | ||
| HttpSvOperatorAppClient.ListOngoingValidatorOnboardings | ||
| ) | ||
| } | ||
|
|
||
| @Help.Summary("Prepare a validator onboarding and return an onboarding secret (via admin API)") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the comment still correct? (via admin API) |
||
| def prepareValidatorOnboarding(expiresIn: FiniteDuration, partyHint: Option[String]): String = | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.PrepareValidatorOnboarding(expiresIn, partyHint) | ||
| HttpSvOperatorAppClient.PrepareValidatorOnboarding(expiresIn, partyHint) | ||
| ) | ||
| } | ||
|
|
||
| @Help.Summary("Update CC price vote (via admin API)") | ||
| def updateAmuletPriceVote(amuletPrice: BigDecimal): Unit = | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.UpdateAmuletPriceVote(amuletPrice) | ||
| HttpSvOperatorAppClient.UpdateAmuletPriceVote(amuletPrice) | ||
| ) | ||
| } | ||
|
|
||
| @Help.Summary("List CC price vote (via admin API)") | ||
| def listAmuletPriceVotes(): Seq[Contract[cp.AmuletPriceVote.ContractId, cp.AmuletPriceVote]] = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.ListAmuletPriceVotes | ||
| HttpSvOperatorAppClient.ListAmuletPriceVotes | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -371,27 +377,27 @@ class SvAppBackendReference( | |
| def listOpenMiningRounds(): Seq[Contract[OpenMiningRound.ContractId, OpenMiningRound]] = { | ||
| consoleEnvironment.run { | ||
| httpCommand( | ||
| HttpSvAdminAppClient.ListOpenMiningRounds | ||
| HttpSvOperatorAppClient.ListOpenMiningRounds | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @Help.Summary("Get the CometBFT node debug dump") | ||
| def cometBftNodeDump(): definitions.CometBftNodeDumpResponse = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAdminAppClient.GetCometBftNodeDump()) | ||
| httpCommand(HttpSvOperatorAppClient.GetCometBftNodeDump()) | ||
| } | ||
|
|
||
| @Help.Summary("Get the sequencer node status") | ||
| def sequencerNodeStatus(): NodeStatus[SpliceStatus] = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAdminAppClient.GetSequencerNodeStatus()) | ||
| httpCommand(HttpSvOperatorAppClient.GetSequencerNodeStatus()) | ||
| } | ||
|
|
||
| @Help.Summary("Get the mediator node status") | ||
| def mediatorNodeStatus(): NodeStatus[SpliceStatus] = | ||
| consoleEnvironment.run { | ||
| httpCommand(HttpSvAdminAppClient.GetMediatorNodeStatus()) | ||
| httpCommand(HttpSvOperatorAppClient.GetMediatorNodeStatus()) | ||
| } | ||
|
|
||
| /** Remote participant this sv app is configured to interact with. */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even call it
HttpSvNoAuthAppClient(don't know which one is scarier)