-
Notifications
You must be signed in to change notification settings - Fork 34
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
[ANCNHOR-626] Update ClientsConfig with SigningKeys and Domains #1355
[ANCNHOR-626] Update ClientsConfig with SigningKeys and Domains #1355
Conversation
core/src/main/java/org/stellar/anchor/config/ClientsConfig.java
Outdated
Show resolved
Hide resolved
platform/src/main/java/org/stellar/anchor/platform/config/PropertyClientsConfig.java
Show resolved
Hide resolved
platform/src/main/java/org/stellar/anchor/platform/config/PropertyClientsConfig.java
Show resolved
Hide resolved
platform/src/test/kotlin/org/stellar/anchor/platform/config/PropertyClientsConfigTest.kt
Show resolved
Hide resolved
platform/src/main/java/org/stellar/anchor/platform/event/EventProcessorManager.java
Outdated
Show resolved
Hide resolved
Can we add tests that has multiple |
Yes I have changed PropertyClientsConfigTest.kt to use I will add tests for |
@@ -42,7 +43,7 @@ public String getClientName(String clientDomain, String account) | |||
throw new SepNotAuthorizedException("Client not found"); | |||
} | |||
|
|||
if (clientDomain != null && !isDomainAllowed(client.getDomain())) { | |||
if (clientDomain != null && !isClientDomainsAllowed(client)) { |
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.
This check looks like a legacy.
We define allowed clients in the clientAllowList
(which allows all clients by default), and based on allowed clients we get allowed domains (using configured clients).
So, this will always be matching the check below, because allowed domains are gathered from allowed client
. So it will always be true if client name is allowed and false otherwise.
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.
You are right, but only if we know the client
is in clientAllowList
for sure. I saw the only call site is the Sep10Service, where the account and domain were extracted from request and passed down here, but does it guarantee the client find is allowed?
If this is the case we should also either move or rename the function indicating this is for Sep10 use only, ClientFinder
is just too general and the validation should be there for other cases.
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.
If it's not in clientAllowList
, wouldn't isClientNameAllowed
also be false?
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.
I see. This check is redundant, we only need to check the name.
platform/src/main/java/org/stellar/anchor/platform/config/PropertyClientsConfig.java
Show resolved
Hide resolved
platform/src/main/java/org/stellar/anchor/platform/config/PropertyClientsConfig.java
Show resolved
Hide resolved
platform/src/main/java/org/stellar/anchor/platform/config/PropertyClientsConfig.java
Show resolved
Hide resolved
platform/src/main/java/org/stellar/anchor/platform/config/PropertySep10Config.java
Outdated
Show resolved
Hide resolved
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.
LGTM!
If you could, do you mind adding tests to check backward compatibility? (i.e. checking that when domain
is defined, domains
is automatically set to set of one domain and same for custodial key)
Just to ensure backward compatibility is covered by the test
@@ -12,8 +12,10 @@ public interface ClientsConfig { | |||
class ClientConfig { | |||
String name; | |||
ClientType type; | |||
String signingKey; | |||
String domain; | |||
@Deprecated String signingKey; // ANCHOR-696 |
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.
Nice!!
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.
LGTM
Yeah test for |
@@ -596,9 +591,9 @@ String getClientName(String account) throws BadRequestException { | |||
if (sep10Config.isClientAttributionRequired() && client == null) { | |||
throw new BadRequestException("Client not found"); | |||
} | |||
if (client != null && !sep10Config.getAllowedClientDomains().contains(client.getDomain())) { | |||
System.out.println(Arrays.toString(sep10Config.getAllowedClientNames().toArray())); |
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.
sout should be removed @JiahuiWho
### Description [[ANCNHOR-626] Update ClientsConfig with SigningKeys and Domains](#1355) introduced change to ClientsConfig, merge develop to bring feature/v3 up to date ### Context Merge `develop` into `feature/v3` ### Testing - `./gradlew test` --------- Co-authored-by: Philip Liu <[email protected]> Co-authored-by: Jamie Li <[email protected]> Co-authored-by: Kanwalpreet Dhindsa <[email protected]> Co-authored-by: Gleb <[email protected]>
Description
signing_key
anddomain
, replace withsigning_keys
anddomains
signing_key
field for noncustodial client (usage only found in validation)signing_key
anddomain
withsigning_keys
anddomains
in related function and test casesTesting
./gradlew test
Documentation
Will update in https://developers.stellar.org/network/anchor-platform/admin-guide/sep10