react-native icon indicating copy to clipboard operation
react-native copied to clipboard

feat(ios): add support disable cache request for NSURLRequest

Open ngocle2497 opened this issue 2 years ago • 5 comments

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

ngocle2497 avatar Jun 23 '23 03:06 ngocle2497

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!

facebook-github-bot avatar Jun 23 '23 03:06 facebook-github-bot

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

analysis-bot avatar Jun 23 '23 03:06 analysis-bot

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

vortexture avatar Aug 09 '23 10:08 vortexture

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);
    }

ngocle2497 avatar Aug 10 '23 02:08 ngocle2497

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.

github-actions[bot] avatar Feb 06 '24 05:02 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Feb 13 '24 05:02 github-actions[bot]

Still an issue

anders-friis-topdk avatar Feb 13 '24 07:02 anders-friis-topdk