Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Latest commit

 

History

History
24 lines (14 loc) · 1.69 KB

avoid-caching-https-requests-responses.md

File metadata and controls

24 lines (14 loc) · 1.69 KB

Avoid Caching HTTP(S) Requests/Responses

Details

By default, iOS’s NSURLRequest will cache responses in the Cache.db file. To prevent this insecure behavior, a developer must explicitly disable caching.

Remediation

The developer can set the cachePolicy property of the NSURLRequest to disable the caching of HTTP(S) requests and responses. One of many methods for disabling caching is shown in the following code snippet (from NSURLConnection Delegate Returns Null on Stack Overflow - http://stackoverflow.com/questions/30667340/nsurlconnection-delegate-returns-null):

(NSCachedURLResponse)connection:(NSURLConnection)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse { return nil;

Developers can find additional methods for disabling the caching of HTTP(S) requests and responses in the Apple Developer article “Understanding Cache Access” referenced below.

References

CWE/OWASP