talsec / Free-RASP-Flutter

Flutter library for improving app security and threat monitoring on Android and iOS mobile devices.
https://github.com/talsec/Free-RASP-Community
MIT License
194 stars 20 forks source link

No such file or directory @ realpath_rec #64

Closed fabienbranchel closed 1 year ago

fabienbranchel commented 1 year ago

Describe the bug Can't run project with v5.0.0, error is :

No such file or directory @ realpath_rec - /Users/dev/.pub-cache/hosted/pub.dev/freerasp-5.0.0/ios/Release
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/project.rb:326:in `realpath'

To Reproduce

Expected behavior Project is running fine.

Screenshots N/A

Please complete the following information:

Additional context

msikyna commented 1 year ago

Hello @fabienbranchel , thank you for reporting this. We are actively looking in to the issue.

Kind regards, Talsec team

yardexx commented 1 year ago

Hello.

We managed to pinpoint the issue and found a way to fix the issue:

  1. Remove freerasp from your pubspec.yaml (by commenting line or running dart pub remove)
  2. Run pub getto sync dependencies
  3. Clean pub cache by running dart pub cache clean
  4. Confirm it by typing y
  5. Delete .symlinks folder from project
  6. Clean pod cache by running pod cache clean --all
  7. Add freerasp back to your project
  8. Run pub get
  9. Run pod install to test it

Hope this helps.

yardexx commented 1 year ago

Hello @fabienbranchel

Did it help?

fabienbranchel commented 1 year ago

Hello @yardexx

Thank you for your response. Your solution works on my clean new project, but add an another error after on my real project :

Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Running Xcode build...
Xcode build done.                                           14,4s
Failed to build iOS app
Error output from Xcode build:
↳
    2023-05-17 14:07:24.831 xcodebuild[6781:41184] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/cb/6vtgyn8j3w99mpnmp1vp5731jcvg9z/T/flutter_tools.8llN5O/flutter_ios_build_temp_dir1iG4bs/temporary_xcresult_bundle

    Selected xcframework slice ios-arm64_x86_64-simulator
    rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "/Users/branchel/dev/app/ios/Pods/../.symlinks/plugins/freerasp/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/*" "/Users/branchel/dev/app/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/freerasp"
    building file list ... rsync: link_stat "/Users/branchel/dev/app/ios/Pods/../.symlinks/plugins/freerasp/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator//*" failed: No such file or directory (2)
    done

    sent 29 bytes  received 20 bytes  98.00 bytes/sec
    total size is 0  speedup is 0.00
    rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Building targets in dependency order
    note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')

    Result bundle written to path:
        /var/folders/cb/6vtgyn8j3w99mpnmp1vp5731jcvg9z/T/flutter_tools.8llN5O/flutter_ios_build_temp_dir1iG4bs/temporary_xcresult_bundle

Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).

Not sure if it's from freerasp, I tried few not working things found around a Google search with following keywords : "DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default".

It seems to be an existing error around something else, I don't have enough time today to check it further.

What do you think about this error ? Rings a bell ?

yardexx commented 1 year ago

note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')

Did you remove integration script (Go to: Product > Scheme > Edit Scheme... > Build (dropdown arrow) > Pre-actions) when going to 5.0.0 as mentioned in README.md?

If not, remove it and then retry the fix above.

From what we know now is that old integration script is breaking new version and the only option is to clear caches re-integrate freerasp.

fabienbranchel commented 1 year ago

I previously missed "remove integration script" step.

Now, I removed integration script, then try again these steps.

The error change :

Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Running Xcode build...
Xcode build done.                                           151,9s
Failed to build iOS app
Error (Xcode): lib/configure_rasp.dart:6:8: Error: Error when reading '../../.pub-cache/hosted/pub.dev/freerasp-5.0.2/lib/talsec_app.dart': No such file or directory

Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).

And indeed, there is no talsec_app.dart file in this folder.

msikyna commented 1 year ago

Hello @fabienbranchel , in the new version, the import has changed to freerasp.dart: import 'package:freerasp/freerasp.dart';

The integration steps: https://github.com/talsec/Free-RASP-Flutter#step-2-setup-the-configuration-for-your-app

Please let us know if it helped.

fabienbranchel commented 1 year ago

Hello @msikyna,

It works as expected with updates for v5.0.0, thank you. I missed necessary modifications because strangely, there was no warning or error using old import in Android Studio before launch on simulator.