feat(ios): add support disable cache request for NSURLRequest
Summary:
On ios, NSURLRequest cache request by default. The request stored in Cache.db-wal file. Show the file via TextEditor, we can see request response( Authorization, Header, ....). My Pen Test description:
Secure handling of authentication tokens is vital to protect the application, session,and data within. If an attacker can gain access to the authentication token, then access to the application will be granted whilst the token is still valid. Authentication tokens should be handled the same way as user credentials i.e.,not storingor writing down anywhere other than password safes, keystores or keychains.
Changelog:
[IOS] [Added] - Add support ios disable cache
Test Plan:
I tested on my Simulator, run command in application of simulator folder
cat Cache.db-wal | grep -a 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9'
return empty.
- eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9: some text of my access token in response
Hi @MasonLe2497!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 8,895,333 | +1 |
| android | hermes | armeabi-v7a | n/a | -- |
| android | hermes | x86 | n/a | -- |
| android | hermes | x86_64 | n/a | -- |
| android | jsc | arm64-v8a | 9,487,025 | +2 |
| android | jsc | armeabi-v7a | n/a | -- |
| android | jsc | x86 | n/a | -- |
| android | jsc | x86_64 | n/a | -- |
Base commit: c956a1bd6cd1ea88d87497e65a2837dc75b9933b Branch: main
This feature would be fantastic, is there any possibility to get this flag added for Android too? It's also caching under /data/data/YOUR_APP_ID/cache/http-cache
I think we can do it in NetworkingModule.java via BuidConfig.SHOULD_CACHE_REQUEST
resValue "boolean", "SHOULD_CACHE_REQUEST", true
// NetworkingModule.java
// line 305
OkHttpClient.Builder clientBuilder = mClient.newBuilder();
applyCustomBuilder(clientBuilder);
if (BuidConfig.SHOULD_CACHE_REQUEST) {
clientBuilder.cache(null);
}
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This PR was closed because it has been stalled for 7 days with no activity.
Still an issue