talsec / Free-RASP-ReactNative

React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.
https://github.com/talsec/Free-RASP-Community
MIT License
91 stars 12 forks source link

Could not determine the dependencies of task ':freerasp-react-native:compileDebugAidl' #6

Closed virenradadiya closed 1 year ago

virenradadiya commented 1 year ago

Describe the bug I am having an error like Required by the project: free-rasp-react-native while building the app after installing the dependency.

Screenshots error Screenshots image

My build.Gradle image

tompsota commented 1 year ago

Hello @virenradadiya,

Thanks for opening your first issue.

The build failure might be caused by the version of React Native you are using in the project.

Please try to update React Native to a higher patch version as explained here: https://github.com/facebook/react-native/issues/35210

Let us know if that helped.

Best,

Tomas, Talsec developer

msikyna commented 1 year ago

Hello @virenradadiya ,

did you try updating React Native to a higher patch version as @tompsota suggested? Did that help?

Kind regards, Matúš, Talsec dev

muqeet98 commented 1 year ago

@virenradadiya Fixed Issue with these steps:

  1. updated React Native version to 0.69.7

2 .Change syntax of the maven library. Example: Change maven{url = uri("https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp")} with maven { url 'https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp'}

muqeet98 commented 1 year ago

Screenshot 2023-02-21 at 4 25 48 PM

msikyna commented 1 year ago

Hello @virenradadiya ,

were you able to solve the issue? NB: a new version has been released.

Kind regards, Talsec team

wellespaiva-dev commented 1 year ago

Any solution for this problem? I updated the lib version and I keep getting the same error

tompsota commented 1 year ago

Hello @wellespaiva-dev,

what versions of react-native and freerasp-react-native are you using?

Best, Tomas, Talsec developer

wellespaiva-dev commented 1 year ago

"react-native": "0.69.5", "freerasp-react-native": "2.0.1",

I managed to fix the error with @muqeet98 solution, but I'm getting another error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons

I am getting the error when using the function useFreeRasp(config, actions);

I'm calling the function inside the useEffect in the main App.js

tompsota commented 1 year ago

@wellespaiva-dev,

Glad to hear you fixed the first issue.

You see the other error because useFreeRasp is a hook itself and cannot be called inside another hook. You can either move useFreeRasp outside the useEffect or alternatively remove the provided hook and start freeRASP in your useEffect instead. Such useEffect would look like this:

  useEffect(() => {
    setThreatListeners(actions);
    talsecStart(config);

    return () => {
      removeThreatListeners();
    };
  }, []);

You can import all methods from freerasp-react-native module.

The return part is optional, but highly recommended.

Best, Tomas, Talsec developer

msikyna commented 1 year ago

Hello @wellespaiva-dev , did proposed solution work?

Kind regards, Talsec team

wellespaiva-dev commented 1 year ago

Hello @talsec-app, the proposal worked! Thank you very much.

A doubt! Is there any documentation on what each config represents? Is it all necessary to work?

Hugs.

tompsota commented 1 year ago

Hi @wellespaiva-dev,

The keys in config object are explained here: https://github.com/talsec/Free-RASP-ReactNative#the-configuration-object-should-consist-of. If you are developing only for Android, you don't need to specify config for iOS and vice versa.

Does this answer your question?

Best, Tomas, Talsec developer.

wellespaiva-dev commented 1 year ago

Hello @talsec-app I'm building a build on ios and sending it to testFlight, but I'm getting this error when opening the app: Library not load: @rpath/Talsec Runtime.framework/Talsec Runtime

NOTE: The error does not happen in debug mode

msikyna commented 1 year ago

Hello @wellespaiva-dev ,

which version of the freeRASP are you using? Could you show us, how this folder looks? node_modules/freerasp-react-native/ios.

Kind regards, Talsec team

wellespaiva-dev commented 1 year ago

@talsec-app

Captura de Tela 2023-05-23 às 15 18 02 Captura de Tela 2023-05-23 às 15 20 58
msikyna commented 1 year ago

Hello @wellespaiva-dev ,

is the TalsecRuntime.xcframework in that folder a symlink, or is it a folder? Did you integrate previously some of the previous versions of freeRASP?

In the new version, we have removed the dependency on the symlink and integration script switching between the dev and release version of the SDK. You have to remove also the integration script:

  1. Open up the .xcworkspace file
  2. Go to Target -> Build Phases -> Link Binary With Libraries
  3. Remove TalsecRuntime.xcframework
  4. On top bar select Product -> Scheme -> Edit Scheme...
  5. On the left side select Build -> Pre-actions
  6. Find integration script and click trash icon on the right side to remove it
  7. Update freeRASP. If you are getting any errors, check that in node_modules/freerasp-react-native/ios, TalsecRuntime.xcframework is a folder, not a symlink. If it is a symlink, remove it and reinstall the module.
  8. run pod install

Please, let us know if it helps.

wellespaiva-dev commented 1 year ago

Hi @talsec-app,

Regarding the first question, TalsecRuntime.xcframework is a folder (as shown in the image below). The version of freerasp-react-native is more current, 2.0.1.

Captura de Tela 2023-05-24 às 17 06 11

In the second case, TalsecRuntime.xcframework is not found in Target -> Build Phases -> Link Binary With Libraries, as shown in the images below.

Captura de Tela 2023-05-25 às 15 03 43 Captura de Tela 2023-05-25 às 15 04 19

Thirdly, I didn't find that integration script you guys mentioned. The images below show the only scripts that already existed before the implementation of the library.

Captura de Tela 2023-05-24 às 17 01 46 Captura de Tela 2023-05-24 às 17 04 01

Anyway, I'm going to leave the crashlog file that testFlight generates when there is a crash signal in the application.

testflight_feedback.zip

I'm waiting for a possible solution. Hugs.

wellespaiva-dev commented 1 year ago

Hi @talsec-app,

I have updated the library to 2.0.2 and the error persists.

msikyna commented 1 year ago

Hello @wellespaiva-dev ,

did you run pod install in the iOS directory after adding (or upgrading) the plugin? If yes, could we try:

  1. Delete DerivedData folder and make a clean build
  2. Place the TalsecRuntime.xcframework in the Embedded Frameworks (Target -> General -> Frameworks, Libraries, and Embedded Content) manually, then click Embed & Sign
wellespaiva-dev commented 1 year ago

Hi, @talsec-app

I tried to do what you asked and another error occurred! In this error I can't even run the app in debug mode.

Here is the evidence below:

Captura de Tela 2023-05-28 às 13 16 45
tompsota commented 1 year ago

Hi @wellespaiva-dev,

Can you try following?

  1. Ensure that you see the TalsecRuntime.xcframework also in Build Phases > Link Binary With Libraries: Screenshot 2023-05-29 at 13 41 27

If not, please add it there as well:

Screenshot 2023-05-29 at 13 38 10
  1. Go to <yourProject>/ios/Pods/Target Support Files/Pods-<yourProject>
  2. Open Pods-<yourProject>-frameworks-Debug-input-files.xcfilelist and delete line that contains TalsecRuntime
  3. Do the same in these files in that folder as well (there should be one line in each file):
    • Pods-<yourProject>-frameworks-Debug-output-files.xcfilelist
    • Pods-<yourProject>-frameworks-Release-input-files.xcfilelist
    • Pods-<yourProject>-frameworks-Release-output-files.xcfilelist
  4. Clean build folder and build.
  5. Try to run the app. The error should be gone.

If the suggestion above didn't help, can you please answer these questions?

  1. Does this error happen only on TestFlight? E.g. does the app work when you run it in release mode locally?
  2. Is this a clean installation or are you upgrading freeRASP from 1.x.x to 2.x.x?
  3. I noticed that the first Run Script deletes the info.plist file. Although we did not encounter any issues with that so far, it seems suspicious to me. Is there any specific reason why you added that script?

Cheers,

Tomas, Talsec developer

wellespaiva-dev commented 1 year ago

Hi @talsec-app,

I did what you asked and it worked for the problem above, but it keeps closing the app in release versions.

1 - Does this error happen only on TestFlight? E.g. does the app work when you run it in release mode locally? R: There is no local release version, versions are generated via xcode and uploaded directly to TestFlight. Running locally in debug mode the error does not happen.

2 - Is this a clean installation or are you upgrading freeRASP from 1.x.x to 2.x.x? R: When I started the lib it was in version 2.0.1, and I updated it to 2.0.2. I uninstalled and reinstalled and the error persisted. The error occurs since version 2.0.1.

3 - I noticed that the first Run Script deletes the info.plist file. Although we did not encounter any issues with that so far, it seems suspicious to me. Is there any specific reason why you added that script? R: The application contains two targets, so this script refers to the "react-native-config" library, where it checks which target was started to know which .env file to use.

tompsota commented 1 year ago

Hi @wellespaiva-dev,

Can you try following:

  1. Go to Product > Scheme > Edit Scheme...
  2. On left side select Run and change Build Configuration to Release
  3. Run the app

Do you see the error now? This will help us to determine if the problem is in the implementation or only on TestFlight.

Also we just released an updated iOS framework in v2.0.3, can you try it out? Maybe it will help.

Best, Tomas, Talsec developer

msikyna commented 1 year ago

Hello @wellespaiva-dev, did you manage to solve the issue? Does it still persist in v3.1.0?

Kind regards, Talsec team

tompsota commented 1 year ago

Closing the issue due to inactivity. Feel free to reopen if there are any updates.