webauthn-swift icon indicating copy to clipboard operation
webauthn-swift copied to clipboard

Replace SwiftCBOR with PotentCodable

Open marius-se opened this issue 1 year ago • 5 comments

There is a bug in SwiftCBOR causing an application to crash when decoding large amounts of random (/invalid CBOR) bytes. I tried to find the source of this problem in SwiftCBOR, but wasn't successful with that unfortunately.

marius-se avatar Feb 11 '24 23:02 marius-se

For what it's worth, if we want to still use SwiftCBOR, I submitted a fix here https://github.com/valpackett/SwiftCBOR/pull/101 that we can use as a subclass to CBORDecoder if they don't merge the fix.

dimitribouniol avatar Feb 15 '24 14:02 dimitribouniol

that we can use as a subclass to CBORDecoder if they don't merge the fix

nvm, it seems like CBORDecoder is not open, so it can't be subclassed 🫠

dimitribouniol avatar Feb 15 '24 14:02 dimitribouniol

Ah nice! I didn't mention it in this PR yet but PotentCodable has the exact same issue :D I'd still prefer to migrate to PotentCodable since it seems to be more actively maintained. @dimitribouniol would you be okay with shipping the same fix to PotentCodable? I created an issue a few weeks ago here: https://github.com/outfoxx/PotentCodables/issues/65

marius-se avatar Feb 27 '24 05:02 marius-se

Yeah, I saw it afterwards haha. It should be possible, though it'll be a bit more involved since PotentCodables uses a struct for reading, so we'll need to pass the depth down to everything which is a bit more error prone.

Should we consider instead forking SwiftCBOR, cleaning it up with documentation and additional niceties (OrderedDictionaries for one), and making it available under the swift-server umbrella? Their license permits this, though I wanted to check first here to see if there was interest and to also ask Val via Mastodon or something if they were alright with it.

dimitribouniol avatar Feb 27 '24 07:02 dimitribouniol

It should probably live in the swift-server-community org but I'd prefer to see the changes upstreamed if the maintainer is happy to accept a PR

0xTim avatar Mar 20 '24 18:03 0xTim