We have developed an iOS framework to be distributed to other developers to use in their apps and make use of some services we would provide. It works great (in vitro). But, because of the way URL Loading System works in iOS, with a few line of codes all our URLs will be visible to the naked eyes of every developer, including all our HTTPS urls which we hold dear.
I know security by obscurity is never a good idea (shadowed by the common misbelief of HTTPS are always transparent outside clients) but I still have this requirement to somehow make our URLs invisible from implementing developers.
So far I have considered implementing a simple NSURLConnection
alternative for our framework but it seems like a daunting task considering HTTPS requirement and all.
Is there anyway we could prevent NSURLProtocol
from registering more classes or any other options?
Here are some sample codes on how NSURLProtocol
would mess up your security:
class NetSniffer : NSURLProtocol {
override class func canInitWithRequest(request: NSURLRequest) -> Bool {
print("\(request.URL?.absoluteURL)")
return false
}
}
and in your application(_, didFinishLaunchingWithOptions:)-> Bool
:
NSURLProtocol.registerClass(NetSniffer)
P.S.: I can vividly remember a time I tried to change the result of some url connections related to AVPlayer
to create a custom DRM and encountered some unusual facts that none of the data connections were triggered by NSURLProtocol
s! could it be a clue?!