从安全分析中收到警告“删除编译器选项 -rpath 以删除 @rpath”

Mih*_*Oza 5 cocoapods swift ios14 xcode12

我已经为我的 IOS 应用程序完成了质量扫描分析。我收到以下警告:

The binary has Runpath Search Path (@rpath) set. In certain cases an attacker can abuse this feature to run arbitrary executable for code execution and privilege escalation. Remove the compiler option -rpath to remove @rpath.  
Run Code Online (Sandbox Code Playgroud)

我搜索@rpath并在我的代码pod-framework.sh和下面的代码中找到了:

# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
  if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
    local swift_runtime_libs
    swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
    for lib in $swift_runtime_libs; do
      echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
      rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
      code_sign_if_enabled "${destination}/${lib}"
    done
  fi  
Run Code Online (Sandbox Code Playgroud)

那么我可以删除这段代码吗?会影响我的项目吗?

提前致谢。

Pau*_*ien 3

鉴于 Xcode 7 已有五年多的历史,并且应用商店提交至少需要 Xcode 11,因此删除该代码似乎是安全的。

但是,鉴于不应运行脚本代码,@rpath二进制文件中的 可能来自其他内容。