-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: DwC Auth Token not available #337
Conversation
@@ -1 +0,0 @@ | |||
com.sap.cloud.sdk.cloudplatform.security.secret.ScpCfSecretStoreFacade |
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.
driveby cleanup of dead code
@@ -1 +0,0 @@ | |||
com.sap.cloud.sdk.cloudplatform.security.DefaultAuthTokenFacade |
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.
removing this should be fine because the Accessor uses this facade regardless by default (without classloading)
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.
It doesn't if the DwcAuthTokenFacade
is class loaded
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.
Should this be E2E tested?
...nectivity-dwc/src/main/java/com/sap/cloud/sdk/cloudplatform/security/DwcAuthTokenFacade.java
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.
currently drafting an E2E test here based on this test code.
...dplatform/connectivity-dwc/src/main/java/com/sap/cloud/sdk/cloudplatform/DwcHeaderUtils.java
Show resolved
Hide resolved
...dplatform/connectivity-dwc/src/main/java/com/sap/cloud/sdk/cloudplatform/DwcHeaderUtils.java
Outdated
Show resolved
Hide resolved
...nectivity-dwc/src/main/java/com/sap/cloud/sdk/cloudplatform/security/DwcAuthTokenFacade.java
Show resolved
Hide resolved
@Test | ||
void testFacadeIsPickedUpAutomatically() | ||
{ | ||
assertThat(AuthTokenAccessor.getAuthTokenFacade()).isInstanceOf(DwcAuthTokenFacade.class); | ||
} |
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.
👍
private static AuthToken extractAuthTokenFromDwcHeaders() | ||
{ | ||
try { | ||
final String token = DwcHeaderUtils.getDwcTokenOrThrow(); |
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.
[question]
Can you remind me what we decided regarding "DwC header injection" attacks (i.e. someone somehow calls the app and injects their own dwc-*
headers)?
I know we discussed this topic a while back but cannot quite recall what we decided.
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.
we figured not an issue for various reasons, including for example:
- the dwc dependencies don't come in automatically and it's decently unlikely that they can come transitively outside of DwC
- even if they are present, the multi tenancy would not work at all without the dwc headers, so any multi-tenant app should detect this during development
Co-authored-by: Johannes Schneider <[email protected]>
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
… enhancement on top of SAP#337 to include dwc-ias-jwt in header as auth token as well. dwc-ias-jwt is the key used for auth token when dwc is integrated with ias for authentication.
… enhancement on top of SAP#337 to include dwc-ias-jwt in header as auth token as well. dwc-ias-jwt is the key used for auth token when dwc is integrated with ias for authentication.
Context
SAP/cloud-sdk-java-backlog#424.
I think we just forgot to implement this earlier. This change makes our
AuthTokenAccessor
actually return a token in the DwC case. Without this change, one always gets an exception (unless using CAP).Definition of Done
Error handling created / updated & covered by the tests aboveDocumentation updated