fundacaocerti / mobsf-action

GitHub Actions for MobSF
GNU General Public License v3.0
25 stars 23 forks source link

Version 1.7.1 - permission denied during scan #14

Closed sushi2k closed 2 years ago

sushi2k commented 2 years ago

Thank you for fixing the permission denied error when building the container, but now I am getting the following error when trying to scan the IPA:

2022-01-10T22:37:00.0140487Z Creating MobSF Home Directory
2022-01-10T22:37:00.0141096Z Traceback (most recent call last):
2022-01-10T22:37:00.0142730Z   File "/home/mobsf/Mobile-Security-Framework-MobSF/mobsf/MobSF/init.py", line 111, in get_mobsf_home
2022-01-10T22:37:00.0143648Z     os.makedirs(mobsf_home)
2022-01-10T22:37:00.0144239Z   File "/usr/lib/python3.8/os.py", line 223, in makedirs
2022-01-10T22:37:00.0144786Z     mkdir(name, mode)
2022-01-10T22:37:00.0145636Z PermissionError: [Errno 13] Permission denied: '/github/home/.MobSF'
2022-01-10T22:37:00.0184445Z [2022-01-10 22:37:00 +0000] [17] [ERROR] Exception in worker process

My GitHub action:

 name: MobSF (scan IPA)

 on: [push,pull_request]

 jobs:
   build:
     name: Scan
     runs-on: ubuntu-latest
     steps:
       - name: Checkout Repo
         uses: actions/checkout@master

       - name: Run MobSF Analysis
         uses: fundacaocerti/mobsf-action@v1.7.1
         env:
           INPUT_FILE_NAME: test.ipa
           SCAN_TYPE: ipa
           OUTPUT_FILE_NAME: mobsf-report

       - name: Upload MobSF Analysis PDF Result
         uses: actions/upload-artifact@v2
         with:
           name: mobsf-report.pdf
           path: mobsf-report.pdf

       - name: Upload MobSF Analysis JSON Result
         uses: actions/upload-artifact@v2
         with:
           name: mobsf-report.json
           path: mobsf-report.json

Full log:

2022-01-10T22:36:59.2337133Z ##[group]Run fundacaocerti/mobsf-action@v1.7.1
2022-01-10T22:36:59.2337623Z env:
2022-01-10T22:36:59.2339750Z   INPUT_FILE_NAME: test.ipa
2022-01-10T22:36:59.2340164Z   SCAN_TYPE: ipa
2022-01-10T22:36:59.2340588Z   OUTPUT_FILE_NAME: mobsf-report
2022-01-10T22:36:59.2340999Z ##[endgroup]
2022-01-10T22:36:59.2376218Z ##[command]/usr/bin/docker run --name a6825d6b300c280654890b043b7c7f5d32230_69d155 --label 6a6825 --workdir /github/workspace --rm -e INPUT_FILE_NAME -e SCAN_TYPE -e OUTPUT_FILE_NAME -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/iOS-Conf-Training/iOS-Conf-Training":"/github/workspace" 6a6825:d6b300c280654890b043b7c7f5d32230
2022-01-10T22:36:59.8834534Z [2022-01-10 22:36:59 +0000] [14] [INFO] Starting gunicorn 20.1.0
2022-01-10T22:36:59.8840681Z [2022-01-10 22:36:59 +0000] [14] [INFO] Listening at: http://127.0.0.1:8000 (14)
2022-01-10T22:36:59.8841555Z [2022-01-10 22:36:59 +0000] [14] [INFO] Using worker: gthread
2022-01-10T22:36:59.8895266Z [2022-01-10 22:36:59 +0000] [17] [INFO] Booting worker with pid: 17
2022-01-10T22:37:00.0140487Z Creating MobSF Home Directory
2022-01-10T22:37:00.0141096Z Traceback (most recent call last):
2022-01-10T22:37:00.0142730Z   File "/home/mobsf/Mobile-Security-Framework-MobSF/mobsf/MobSF/init.py", line 111, in get_mobsf_home
2022-01-10T22:37:00.0143648Z     os.makedirs(mobsf_home)
2022-01-10T22:37:00.0144239Z   File "/usr/lib/python3.8/os.py", line 223, in makedirs
2022-01-10T22:37:00.0144786Z     mkdir(name, mode)
2022-01-10T22:37:00.0145636Z PermissionError: [Errno 13] Permission denied: '/github/home/.MobSF'
2022-01-10T22:37:00.0184445Z [2022-01-10 22:37:00 +0000] [17] [ERROR] Exception in worker process
2022-01-10T22:37:00.0185058Z Traceback (most recent call last):
2022-01-10T22:37:00.0186062Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-01-10T22:37:00.0186806Z     worker.init_process()
2022-01-10T22:37:00.0187816Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/gthread.py", line 92, in init_process
2022-01-10T22:37:00.0188610Z     super().init_process()
2022-01-10T22:37:00.0189561Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py", line 134, in init_process
2022-01-10T22:37:00.0190292Z     self.load_wsgi()
2022-01-10T22:37:00.0191199Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-01-10T22:37:00.0191977Z     self.wsgi = self.app.wsgi()
2022-01-10T22:37:00.0192898Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/app/base.py", line 67, in wsgi
2022-01-10T22:37:00.0193635Z     self.callable = self.load()
2022-01-10T22:37:00.0194593Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-01-10T22:37:00.0195330Z     return self.load_wsgiapp()
2022-01-10T22:37:00.0196318Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-01-10T22:37:00.0197121Z     return util.import_app(self.app_uri)
2022-01-10T22:37:00.0198389Z   File "/usr/local/lib/python3.8/dist-packages/gunicorn/util.py", line 359, in import_app
2022-01-10T22:37:00.0199202Z     mod = importlib.import_module(module)
2022-01-10T22:37:00.0199911Z   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
2022-01-10T22:37:00.0200685Z     return _bootstrap._gcd_import(name[level:], package, level)
2022-01-10T22:37:00.0201420Z   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2022-01-10T22:37:00.0202141Z   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2022-01-10T22:37:00.0202908Z   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2022-01-10T22:37:00.0203669Z   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2022-01-10T22:37:00.0204452Z   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
2022-01-10T22:37:00.0205260Z   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2022-01-10T22:37:00.0206558Z   File "/home/mobsf/Mobile-Security-Framework-MobSF/mobsf/MobSF/wsgi.py", line 16, in <module>
2022-01-10T22:37:00.0207437Z     from . import settings
2022-01-10T22:37:00.0208603Z   File "/home/mobsf/Mobile-Security-Framework-MobSF/mobsf/MobSF/settings.py", line 32, in <module>
2022-01-10T22:37:00.0209787Z     DWD_DIR = os.path.join(MobSF_HOME, 'downloads/')
2022-01-10T22:37:00.0210461Z   File "/usr/lib/python3.8/posixpath.py", line 76, in join
2022-01-10T22:37:00.0211183Z     a = os.fspath(a)
2022-01-10T22:37:00.0211832Z TypeError: expected str, bytes or os.PathLike object, not NoneType
2022-01-10T22:37:00.0212745Z [2022-01-10 22:37:00 +0000] [17] [INFO] Worker exiting (pid: 17)
2022-01-10T22:37:00.0651559Z [2022-01-10 22:37:00 +0000] [14] [INFO] Shutting down: Master
2022-01-10T22:37:00.0652300Z [2022-01-10 22:37:00 +0000] [14] [INFO] Reason: Worker failed to boot.
2022-01-10T22:37:01.7258307Z [/api/v1/upload] Upload the app to MobSF
2022-01-10T22:37:01.7346025Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2022-01-10T22:37:01.7346727Z                                  Dload  Upload   Total   Spent    Left  Speed
2022-01-10T22:37:01.7347065Z 
2022-01-10T22:37:01.7356287Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2022-01-10T22:37:01.7356940Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2022-01-10T22:37:01.7357529Z curl: (7) Failed to connect to localhost port 8000: Connection refused
leinardi commented 2 years ago

@sushi2k you may want to have a look here: https://github.com/fundacaocerti/mobsf-action/issues/15#issuecomment-1039744681