Skip to content
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 supportsSecureCoding for intercepted classes #716

Merged
merged 5 commits into from
Jan 31, 2020

Conversation

bamx23
Copy link
Contributor

@bamx23 bamx23 commented Jul 31, 2019

Hi!

For at least a year I've been meeting the same problem: if there is an NSDate stub and test fails, test run fails(crashes) with something like this:

Class 'NSDate' has a superclass that supports secure coding, but 'NSDate' overrides -initWithCoder: and does not override +supportsSecureCoding. The class must implement +supportsSecureCoding and return YES to verify that its implementation of -initWithCoder: is secure coding compliant.

Today I've finally decided to figure out what is the problem. It all ended up with this patch.
Maybe someone has any idea about how to solve the problem more properly?

@bamx23
Copy link
Contributor Author

bamx23 commented Oct 31, 2019

@ecaselles Could you look at this pull-request?

@ecaselles
Copy link
Member

Seems solid @bamx23 and apologies for the delay in the reply. It would be great if you could add a test to reproduce the original issue and then verify the patch solves it. That way, we make sure is covered for the future :)

@bamx23
Copy link
Contributor Author

bamx23 commented Jan 3, 2020

I feel it might be slightly difficult because reproducing the issue means breaking test runs. But I'll try to reproduce it anyway, sure.

@bamx23
Copy link
Contributor Author

bamx23 commented Jan 10, 2020

@ecaselles, I've implemented a test that reproduces the problem. Unfortunately, I haven't found any simpler way. There is a - [NSCoder validateClassSupportsSecureCoding:], which will return NO for [NSDate class] without my changes, but it's a private API.

@ecaselles
Copy link
Member

ecaselles commented Jan 29, 2020

Thanks @bamx23! It looks good to me. I agree it is not ideal and a bit stretched, but it works for checking your changes. I am happy to merge it as it is or we can add a comment explaining the rationale for this test if you think it will make it easier for future reference. What do you think?

@ecaselles ecaselles merged commit ff3f34c into kiwi-bdd:master Jan 31, 2020
@ecaselles
Copy link
Member

Merging it @bamx23 so it's part of #719. Thanks for you help! 👏

@bamx23
Copy link
Contributor Author

bamx23 commented Jan 31, 2020

Thanks for merging! I wanted to add a comment early next week. If the next version will not have been released before that. Or maybe even if it will be released because comments are helpful either way.

@bamx23
Copy link
Contributor Author

bamx23 commented Feb 4, 2020

Here it is #721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants