Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Remove usage of response intents from retrieve BBQ flow #132

Merged
merged 2 commits into from
Oct 23, 2017

Conversation

iainmcgin
Copy link
Member

Fix for #131. In order to avoid the potential for code injection and request forgery attacks
from malicious providers, this change deprecates the use of intents as part of the retrieve
BBQ flow. Instead, providers now signal the availability of credentials via a simple boolean.
Optionally, they can also specify preloaded data that the client should send back to them
verbatim, as a replacement for the ability to specify intent extras on returned intents.

Fix for openid#131. In order to avoid the potential for code injection and request forgery attacks
from malicious providers, this change deprecates the use of intents as part of the retrieve
BBQ flow. Instead, providers now signal the availability of credentials via a simple boolean.
Optionally, they can also specify preloaded data that the client should send back to them
verbatim, as a replacement for the ability to specify intent extras on returned intents.
@codecov-io
Copy link

codecov-io commented Oct 19, 2017

Codecov Report

Merging #132 into master will increase coverage by 0.35%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #132      +/-   ##
===========================================
+ Coverage     71.85%   72.2%   +0.35%     
+ Complexity      482     476       -6     
===========================================
  Files            65      64       -1     
  Lines          2690    2634      -56     
  Branches        246     243       -3     
===========================================
- Hits           1933    1902      -31     
+ Misses          682     661      -21     
+ Partials         75      71       -4
Impacted Files Coverage Δ Complexity Δ
.../java/org/openyolo/protocol/ProtocolConstants.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...nyolo/api/internal/CredentialRetrieveActivity.java 0% <0%> (ø) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b7394f...965eba1. Read the comment docs.

@iainmcgin
Copy link
Member Author

There are no tests for the CredentialRetrieveActivity right now, but I'll add them in follow-up. Activity testing is a pain :(

Copy link
Collaborator

@StanKocken StanKocken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on the new flow but I have an issue with the retro-compatibility of this change as described into my comments.

@@ -67,7 +65,7 @@ protected void processCredentialRequest(

Intent retrieveIntent = RetrieveActivity.createIntent(applicationContext);
CredentialRetrieveBbqResponse response = CredentialRetrieveBbqResponse.newBuilder()
.setRetrieveIntent(ByteString.copyFrom(IntentUtil.toBytes(retrieveIntent)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Intent retrieveIntent = RetrieveActivity.createIntent(applicationContext); is not used anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd ignore the trapdoor code for now, I'm actually going to delete this provider as it's not a good example any more (it treats retrieve() like hint()).

retrieveIntent.getComponent().getPackageName())) {
Log.w(LOG_TAG, "Package mismatch between provider and retrieve intent");
continue;
Intent retrieveIntent = new Intent(ProtocolConstants.RETRIEVE_CREDENTIAL_ACTION);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are deprecating retrieve intent, but here it will be just ignored. So we are breaking the compatibility if a provider don't have the action org.openyolo.credential.retrieve, as it was not require before (and it's my case).

I think we should have both, and prefer the action org.openyolo.credential.retrieve if the provider did set getCredentialsAvailable().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we'll support the old intent for 0.3.0 but please do add support for direct invocation of the retrieve flow ASAP. It's actually required in the spec:

http://openid.net/specs/openyolo-android-ID1.html#retrieving-credentials

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right, I've made the change on my side. It will be live in ~ 2 weeks.

// used.
// TODO: remove backwards compatibility with retrieve_intent after 0.3.0
if (!response.getCredentialsAvailable()
&& !response.getRetrieveIntent().isEmpty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& !response.getRetrieveIntent().isEmpty()
=> && response.getRetrieveIntent().isEmpty(), no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as the code has been reordered to fit your request for using the old intent as a fallback.

Copy link
Collaborator

@StanKocken StanKocken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iainmcgin iainmcgin merged commit 7edbce2 into openid:master Oct 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants