Parse-SDK-iOS-OSX icon indicating copy to clipboard operation
Parse-SDK-iOS-OSX copied to clipboard

feat: Add SecureEncoder support to PFFileObject

Open dhoerl opened this issue 1 year ago • 4 comments

New Pull Request Checklist

  • [X ] I am not disclosing a vulnerability.
  • [X ] I am creating this PR in reference to an issue.

Issue Description

PFFileObjects can be used outside of a PFObject subclass. When archiving them and other objects using the NSSecureEncoder, the encoder now fails with an error that PFFileObjects are not secure coding compliant.

Fine - in Objective-C, I create a class extension to add it. Works fine. However, when I go to change that extension to Swift, the compilation fails with the error that NSSecureCoding cannot be added in a class extension (but must be done by the original class).

Closes: #1736

Approach

Add NSSecureCoding to PFFileObject:

  • return YES from the class method supportsSecureCoding
  • encode the object using the existing PFEncoder objectEncoder
  • decode the object using PFDecoder objectDecoder

TODOs before merging

  • [ ] Add tests
  • [ ] Add changes to documentation (guides, repository pages, in-code descriptions)

dhoerl avatar Dec 31 '23 17:12 dhoerl

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

I will reformat the title to use the proper commit message syntax.

Would you want to add a test so we can merge this?

mtrezza avatar Apr 06 '24 20:04 mtrezza

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 3.77%. Comparing base (dd05d41) to head (0d28a0f). Report is 3 commits behind head on master.

:exclamation: Current head 0d28a0f differs from pull request most recent head ea4346d. Consider uploading reports for the commit ea4346d to get more accurate results

Files Patch % Lines
Parse/Parse/Source/PFFileObject.m 0.00% 15 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #1768       +/-   ##
==========================================
- Coverage   64.24%   3.77%   -60.48%     
==========================================
  Files         201     155       -46     
  Lines       23233   17952     -5281     
==========================================
- Hits        14926     677    -14249     
- Misses       8307   17275     +8968     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 06 '24 21:04 codecov[bot]