facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.47k stars 24.26k forks source link

Modal not respecting window flags (FLAG_SECURE) on Android #38537

Open CaioQuirinoMedeiros opened 1 year ago

CaioQuirinoMedeiros commented 1 year ago

Description

I am trying to disable screenshot and screen recording on my application, for security purpose. I've known that it can be done by setting the flags FLAG_SECURE on activity window

It works... screenshots are not allowed and screen recording get all black... exepct the Modal! The Modal is still shown on the screen recording. Why is that? There are any way to fix that? I tried to set the flag for all activities but still no success.

React Native Version

0.72.3

Output of npx react-native info

System: OS: macOS 13.0.1 CPU: (8) arm64 Apple M1 Memory: 112.33 MB / 8.00 GB Shell: version: 5.8.1 path: /bin/zsh Binaries: Node: version: 16.14.0 path: ~/.nvm/versions/node/v16.14.0/bin/node Yarn: version: 1.22.19 path: ~/.yarn/bin/yarn npm: version: 8.3.1 path: ~/.nvm/versions/node/v16.14.0/bin/npm Watchman: version: 2022.05.16.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.11.3 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms:

Steps to reproduce

  1. Create a new React Native project
  2. Set the window flags as FLAG_SECURE as described here (remember to build after that)
  3. Start recording and use the App, use a Modal.
  4. Check that the Modal is shown on the recorded video

Snack, code example, screenshot, or link to a repository

https://github.com/CaioQuirinoMedeiros/test-modal-window-flag

Without FLAG_SECURE

https://github.com/facebook/react-native/assets/48543208/b854560a-8557-429f-b299-09acea88bdb4

With FLAG_SECURE

https://github.com/facebook/react-native/assets/48543208/acaf5b47-f8b2-4cf4-aabd-40791cafa2e0

CaioQuirinoMedeiros commented 1 year ago

https://commonsware.com/blog/2016/06/06/psa-flag-secure-window-leaks.html Found this blog article that explains a lot... can I somehow add flags to the Dialog window used by Modal component? it should be done on ReactModalHostView? I'd have to build RN from source?

dragorwyin commented 11 months ago

Hello, I'm joining with the issue report. The same thing happens for all our modals. Pinging up for the questions from @CaioQuirinoMedeiros

dragorwyin commented 9 months ago

Hello, pinging a request :)

bakhiem commented 8 months ago

Yes, I got the same problem