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

Potential Security Risk - Update BTClientToken in BraintreeCore to use NSSecureCoding protocol #1508

Closed
samfriedmanfuji opened this issue Jan 30, 2025 · 2 comments · Fixed by #1509

Comments

@samfriedmanfuji
Copy link

Is your feature request related to a problem? Please describe.

The BTClientToken class in BraintreeCore conforms to the NSCoding protocol, and its init method uses the function decodeObject(forKey:) (in Braintree 6.x in Swift; the same function decodeObjectForKey: is used in Braintree 5.x in Objective-C). This is a potential security issue as it is vulnerable to object substitution attacks. The NSSecureCoding protocol should be used instead to protect against such attacks.

Describe the solution you'd like.

From Apple Documentation for NSSecureCoding:

An object that does override init(coder:) must decode any enclosed objects using the decodeObjectOfClass:forKey: method. For example:

let obj = decoder.decodeObject(of:MyClass.self, forKey: "myKey")

In addition, the class must override the getter for its supportsSecureCoding property to return true.

Please update BTClientToken in both Braintree 5 and 6 with these changes to protect against object substitution attacks.

@jaxdesmarais
Copy link
Contributor

Hey @samfriedmanfuji -

Thanks for bringing this to our attention! We will work to get this updated for v6 of the SDK. I will update here once we have put up and merged a PR for this work.

We will not be updating v5 as that SDK is deprecated as of June 2024 as listed here. Per our documentation we do not make updates to deprecated versions of our SDKs. It's also worth noting v5 will be fully unsupported starting June 2025 and at that point processing for these SDKs can be suspended at any time. We highly recommend that merchants migrate to v6 before this date.

@jaxdesmarais
Copy link
Contributor

This change was released in version 6.28.0 of the SDK. Please reach back out if you continue to run into issues once updating the SDK.

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 a pull request may close this issue.

2 participants