Commit Graph

496 Commits

Author SHA1 Message Date
Daniel Hammond
0a023409b1 Fix crash on mac (and 32-bit iOS?) - don't represent SRDelegateAvailableMethods as a bitfield (#530)
* Don't represent SRDelegateAvailableMethods as a bitfield

Since Objective-C uses a signed char for BOOL on some platforms (macOS and 32-bit iOS) packing this into a bitfield doesn't work since when it tries to read the field it looks for the sign bit and fails with an EXC_BAD_INSTRUCTION. This change sacrifices a few bits for the extra portability.

* CR - followup
2018-04-28 10:43:15 -07:00
Richard Ross
28035e1a98 Deprecate SSL pinning and trust chain verification. (#534)
Oh boy. Here's a controversial change.
![](http://i.imgur.com/t8JjQix.gif)

Let's give a bit of backstory.

A few weeks ago, Facebook was contacted by a whitehat hacker (the good
guys) about a security vulnerability here in SocketRocket.

For those of you who are truly interested in what that security flaw
was, it is essentially the same flaw as outlined here:

https://www.synopsys.com/blogs/software-security/ineffective-certificate-pinning-implementations/

So, we were faced with a choice - quietly push out a patch, and hope
that eventually existing applications updated, or be transparent and
admit we screwed up.

This is us admititng we screwed up. And while yes, we could probably fix
the implementation. But we talked internally, and decided that the best
approach here is to completely remove the option for pinning.

For all of our existing users that use certificate pinning, while we
understand that in the past there has been a very large barrier to entry
with getting a CA to issue a certificate.

However, since the rollout of CAs like LetsEncrypt, there's become an
ever-dwindling reason to actually use self-signed or unsigned
certificates.

For this reason, we're going to go ahead and deprecate the APIs that
allow SSL pinning and disabling trust chain verification. The pinning
APIs are now going to throw an exception when invoked, and the trust
chain APIs have deprecation warnings.

If you are a user of these APIs, and you for some reason **CANNOT** use
a trust chain validated certificate, PLEASE speak up. While we cannot
think of any reason to use those kinds of certificates, it's entirely
possible we overlooked something. We'll leave this pullrequest unmerged
for a two week period (Monday, August 28th, 2017), at which point,
unless we have feedback convincing us otherwise, we will go ahead with
this change.
2017-08-30 14:19:48 -07:00
Erik Price
877ac7438b Make copying optional when receiving data (#428)
* Reduce memory usage

Reduce memory usage by discarding, not resetting, the frame data buffer.
Let delegate control copying.

* Delegate methods expect `self`

* Add `-sendWithoutCopyingData:error:`

* Add `-webSocket:shouldCopyReceivedData:`

* Fix error messages

* Remove `-webSocket:shouldCopyReceivedData:`

* Revert "Fix error messages"

This reverts commit 4d5f5f018d0c953c9f9c9394f284f8358a039f90.

* Fix typo

* Copy only control frames

* Fix error message
2016-10-31 11:17:35 -07:00
Enrique Osuna
20686b9990 Ensure test environment is ready (#462)
When running tests, lets make sure that the test environment is ready to go.
2016-10-31 11:16:31 -07:00
woudini
41b57bb2fc Fix memory leak by freeing mutex. (#469) 2016-09-14 00:08:27 -07:00
Nikita Lutsenko
04b28a7c56 Add optional delegate method for received ping. (#463) 2016-08-25 16:41:07 -07:00
Nikita Lutsenko
d09212793c Merge pull request #461 from facebook/nlutsenko.lint
Lint, cleanup and fix analyzer warning.
2016-08-24 13:35:34 -07:00
Nikita Lutsenko
eff1db8da7 Fix missing prototypes for C functions. 2016-08-23 17:20:15 -07:00
Nikita Lutsenko
103dc2623b Cleanup and update summary for podspec. 2016-08-23 14:57:52 -07:00
Nikita Lutsenko
45f03ed9b9 Fix static analyzer warning in SRProxyConnect. 2016-08-23 14:53:19 -07:00
Nikita Lutsenko
35e965f2c5 Update xctoolchain to latest. 2016-08-23 14:53:19 -07:00
Nikita Lutsenko
3e5be70f1b Lint and cleanup source files. 2016-08-23 14:53:13 -07:00
Nikita Lutsenko
fc0aad7844 Remove no longer relevant Makefile. 2016-08-23 14:53:03 -07:00
Nikita Lutsenko
00a8a66240 Merge pull request #455 from facebook/nlutsenko.proxy.crash
Optimize input queue processing in SRProxyConnect.
2016-08-22 17:42:44 -07:00
Nikita Lutsenko
47971ebe5e Merge pull request #460 from facebook/nlutsenko.warning
Fix warnings on few potential clang configurations.
2016-08-22 16:06:16 -07:00
Nikita Lutsenko
9c2201f099 Cleanup proxy connect reference when socket is opened asynchronously. 2016-08-22 15:23:50 -07:00
Nikita Lutsenko
88cdc0b586 Optimize input queue processing in SRProxyConnect. 2016-08-22 15:23:50 -07:00
Nikita Lutsenko
ee6dd82992 Remove default: case in switch where all possible values are handled. 2016-08-22 15:12:18 -07:00
Nikita Lutsenko
abea58207e Fix nullability analysis in SRHTTPConnectMessage. 2016-08-22 15:11:58 -07:00
Nikita Lutsenko
cccbf71a7b Merge pull request #453 from facebook/nlutsenko.cleanup
Update configurations and unbreak compilation of a sample app.
2016-08-08 12:57:27 -07:00
Nikita Lutsenko
682be00378 Unbreak compilation of TestChat app. 2016-08-08 10:46:35 -07:00
Nikita Lutsenko
85dd530191 Update xctoolchain to latest. 2016-08-08 10:45:19 -07:00
Nikita Lutsenko
691241f102 Extract and cleanup setting network service type on input/output streams. 2016-08-08 10:45:17 -07:00
Fjölnir Ásgeirsson
ff03b396a0 Fixed build on under iOS 10 SDK (#450)
iOS 10 adds NSURLNetworkServiceTypeCallSignaling
which made this switch in
setupNetworkServiceType non-exhaustive
2016-07-29 11:54:47 -07:00
Nikita Lutsenko
471b99ccde Remove pages submodule reference. (#452) 2016-07-28 15:59:14 -07:00
Nikita Lutsenko
130967bcb9 Unify usage of default buffer size between SRWebSocket and SRProxyConnect. (#449) 2016-07-28 14:38:02 -07:00
Nikita Lutsenko
ecf7f75de3 Force linking of object files for built-in Foundation categories. (#441) 2016-07-08 18:33:15 -07:00
Richard Ross
4184f74f18 Make payload masking use vector instructions. (#440)
This is up to 50x faster when running on an ARM64 device, and effects
every payload we send out from the device.
2016-07-08 15:12:33 -07:00
Nikita Lutsenko
0632997fe7 Merge pull request #439 from mortonfox/patch-1
Update link to license
2016-07-08 11:46:02 -07:00
Morton Fox
84424d470a Update link to license 2016-07-08 12:30:48 -04:00
Nikita Lutsenko
f2e6387948 Improve type-safety on sending frames and remove extraneous class checks. (#438) 2016-07-07 19:53:15 -07:00
Nikita Lutsenko
ab462e597c Merge pull request #437 from facebook/nlutsenko.configurations
Update all targets to use shared configuration files from xctoolchain.
2016-07-06 13:24:02 -07:00
Nikita Lutsenko
e698ab30eb Fix undefined behavior on sending/reading the data. 2016-07-06 12:28:29 -07:00
Nikita Lutsenko
b666a4559a Remove usage of deprecated Endian with CFSwap. 2016-07-06 12:28:29 -07:00
Nikita Lutsenko
676948f555 Update Travis-CI configuration for new target names. 2016-07-06 12:28:29 -07:00
Nikita Lutsenko
eda51aba1b Fix all new warnings. 2016-07-06 12:28:29 -07:00
Nikita Lutsenko
a944d5fcbb Fixed documentation for SRWebSocketDelegate. 2016-07-06 12:28:29 -07:00
Nikita Lutsenko
e84a8fd596 Update all targets to shared configurations from xctoolchain. 2016-07-06 12:28:29 -07:00
Nikita Lutsenko
4605a70d61 Add xctoolchain submodule. 2016-07-05 19:36:39 -07:00
Nikita Lutsenko
2abdcb9614 Fix errors in TestChat application. (#431) 2016-07-01 17:51:15 -07:00
Nikita Lutsenko
71a52a57a2 Update README and CONTRIBUTING to Markdown and new documentation. (#432) 2016-07-01 14:58:33 -07:00
Michael Kirk
8096fef47d Pluggable, more flexible, security policies. (#429)
Extract @fredericjacobs' CertificateVerifier concept with @nlutsenko's
SRSecurityOptions into a pluggable SRSecurityPolicy model

This retains existing SSL configuration code paths, while allowing users
more flexibility to specify their own security policy.

If you are alread using AFNetworking and an `AFSecurityPolicy`, it's
intended that you can share domain trust logic by delegating
`SRSecurityPolicy evaluateTrust:ForDomain` to your AFSecurityPolicy
instance.

Inspired by original "Require TLS 1.2 & enable pinning" pull request by
Frederic Jacobs (@fredericjacobs) at:

https://github.com/facebook/SocketRocket/pull/274/files
2016-06-30 20:25:06 -07:00
Michael Kirk
b4e7932a59 specify ruby version for CI (#430)
CI is currently failing because the default ruby on travis.org is 2.0,
but a dependency xcpretty, requires the latest activesupport, which
requires ruby >=2.2
2016-06-30 17:09:35 -07:00
Erik Price
fcd482898a Make copying optional when sending data (#427)
* Reduce memory usage

Reduce memory usage by discarding, not resetting, the frame data buffer.
Let delegate control copying.

* Delegate methods expect `self`

* Add `-sendWithoutCopyingData:error:`

* Add `-webSocket:shouldCopyReceivedData:`

* Update test script name in Makefile

* use a Swiftier name

* Fix error messages

* Remove `-webSocket:shouldCopyReceivedData:`

* Remove assertion

* Fix typo
2016-06-28 15:43:44 -07:00
Nikita Lutsenko
48465aeaae Update public APIs for Swift 3 API Guidelines. (#419) 2016-06-27 19:26:54 -07:00
Nikita Lutsenko
16abb5debd Use error pointers instead of asserts for validating status on send:. (#416) 2016-06-27 18:32:08 -07:00
Nikita Lutsenko
e22b67e56a Make readyState KV Observable and fully thread-safe. (#420) 2016-06-27 17:27:58 -07:00
Nikita Lutsenko
52017adfb4 Improve SRStatusCode import into Swift. (#418) 2016-06-27 17:23:55 -07:00
Nikita Lutsenko
29d8e0e832 Unify logging in SRWebSocket, SRProxyConnect. (#417) 2016-06-27 15:20:32 -07:00
Nikita Lutsenko
0af058c221 Merge pull request #415 from facebook/nlutsenko.cleanup
Split creation of CFHTTPMessage and random data into separate source files.
2016-06-17 15:06:14 -07:00