8000 CRL checking to optionally try all URLs by mmoayyed · Pull Request #992 · apereo/cas · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CRL checking to optionally try all URLs #992

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

Merged
merged 6 commits into from
Jul 19, 2015
Merged

CRL checking to optionally try all URLs #992

merged 6 commits into from
Jul 19, 2015

Conversation

mmoayyed
Copy link
Member

Closes #927

The present behavior stops at the first entry found. Optionally, this pull allows CAS to check all and only report back if all fail.

@mmoayyed mmoayyed added this to the 4.1.0 milestone Jun 11, 2015
@mmoayyed
Copy link
Member Author

bump

@mmoayyed
Copy link
Member Author
mmoayyed commented Jul 6, 2015

Heads up. Merging by Wednesday morning, unless there are comments.

@mmoayyed
Copy link
Member Author
mmoayyed commented Jul 9, 2015

Bump

@mmoayyed
Copy link
Member Author

@leleuj have u had a chance to review this one? I'll merge with master of course.

}
}

if (revokedCrls.size() == crls.size() && !revokedCrls.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just nitpicking on this: if we are here, the crls.size() does not equal the expiredCrls.size() so after removing all expired CRL (crls.removeAll(expiredCrls);), the crls cannot be empty, so again, if you want the revokedCrls list to be the same size as the crls list, you don't need the !revokedCrls.isEmpty() check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Let me rework the conditions and I'll add a few more test cases to cover all cases.

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 had a 2nd look at this.

This check here:

(revokedCrls.size() == crls.size() && !revokedCrls.isEmpty())

This check here says: if all remaining crls (after checking and removing those that are expired) are considered revoked, then throw the exception and apply the policy. Otherwise, proceed. Because you may find that 5 crls are remaining, and only 2 of them have been revoked. So the 3 that remain are valid and we wouldn't need to apply the policy to those. The policy is only applied if everything is considered revoked; thus the check.

Does that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand this check: revokedCrls.size() == crls.size(): if all crls are revoked, let's throw an exception. What I say if this condition is true, the revokedCrls being equals to the crls which cannot be empty, then the second check is not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me propose this:

You have 5 CRLs initially. Once you go through the loop, you realize 5 are expired. So you remove the expired 5 from the original set. At this point:

crls.size = 0

and because of that:
revokedCrls.size = 0

So it turns out that revokedCrls.isEmpty() is needed. If you take this check out, a revoked certificate exception will be thrown when all CRLs are expired and removed, and that is not what you want.

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 think this is the last remaining issue here before we merge; let me know if that helps to clarify the logic here.

Copy link
Contributor

Choose a reason for hiding this comment

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

If all crls are expired, you are trapped in the first if check (https://github.com/Jasig/cas/pull/992/files#diff-1cc175d11f2a81cb0773374cd6d0038cR91) and never goes through the else clause we are talking about.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are perfectly right! Removed the check. Thanks for bearing with me.

@mmoayyed
Copy link
Member Author

@leleuj I am assuming all feedback is accounted for?

@leleuj
Copy link
Contributor
leleuj commented Jul 19, 2015

Yes, +1

mmoayyed pushed a commit that referenced this pull request Jul 19, 2015
CRL checking to optionally try all URLs
@mmoayyed mmoayyed merged commit aca1a44 into apereo:master Jul 19, 2015
@mmoayyed mmoayyed deleted the crl-checkall branch July 19, 2015 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0