google / google/turbinia

Docker-explorer task fails without proper error message

Open
#747 0 comments 0 reactions 0 assignees View on GitHub
Tiny
Dominant language
Python
Stars
794
Forks
172
PR merge metrics
No merged PRs in 30d

Description

When a filesystem is analysed for Docker containers the below error is thrown if no docker path is available (as it tries to parse the faulty json output of the de.py command). We should think of a better error.

```
2021-02-15 13:31:54 [INFO] Found filesystem type ntfs for path /dev/loop4
2021-02-15 13:31:54 [INFO] Running: sudo mount -o ro /dev/loop4 /mnt/turbinia-mounts/turbiniaxfr8s_cw
2021-02-15 13:31:55 [WARNING] Docker daemon confile file not found. Using default Docker installation path.
2021-02-15 13:31:55 [INFO] Running sudo /usr/local/bin/de.py -r /mnt/turbinia-mounts/turbiniaxfr8s_cw/var/lib/docker list all_containers 2021-02-15 13:31:55,284 [ERROR] (MainProcess) PID:591 Please specify a proper Docker directory path.
hint: de.py -r /var/lib/docker
2021-02-15 13:31:55 [ERROR] DockerContainersEnumerationTask Task failed with exception: [Expecting value: line 1 column 1 (char 0)]
2021-02-15 13:31:55 [ERROR] Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/turbinia-20210208.3-py3.6.egg/turbinia/workers/__init__.py", line 778, in run_wrapper
self.result = self.run(evidence, self.result)
File "/usr/local/lib/python3.6/dist-packages/turbinia-20210208.3-py3.6.egg/turbinia/workers/docker.py", line 105, in run
containers_info = self.GetContainers(evidence)
File "/usr/local/lib/python3.6/dist-packages/turbinia-20210208.3-py3.6.egg/turbinia/workers/docker.py", line 82, in GetContainers containers_info = json.loads(json_string)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2021-02-15 13:31:55 [ERROR] DockerContainersEnumerationTask Task failed with exception: [Expecting value: line 1 column 1 (char 0)]
2021-02-15 13:31:55 [INFO] Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/turbinia-20210208.3-py3.6.egg/turbinia/workers/__init__.py", line 778, in run_wrapper
self.result = self.run(evidence, self.result)
File "/usr/local/lib/python3.6/dist-packages/turbinia-20210208.3-py3.6.egg/turbinia/workers/docker.py", line 105, in run
containers_info = self.GetContainers(evidence)
File "/usr/local/lib/python3.6/dist-packages/turbinia-20210208.3-py3.6.egg/turbinia/workers/docker.py", line 82, in GetContainers
containers_info = json.loads(json_string)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```

Contributor guide

Open the contributing guide

Research direction

Start in turbinia/workers/docker.py at GetContainers and the DockerContainersEnumerationTask path that runs de.py against the mounted filesystem. Reproduce the missing Docker directory case and inspect how the command output is parsed. Done means the task reports a useful Docker-path error instead of exposing a JSON decoding failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.