ICTU / zap2docker-auth-weekly

Zap baseline scanner in Docker with authentication
Apache License 2.0
104 stars 70 forks source link

Permission to working directory denied, report generation fails #14

Closed n7902 closed 4 years ago

n7902 commented 4 years ago

Noticed that the reports for my scans were not being generated. Ran below command in debug mode and found it is unable to write to the directory.

command: docker run --network="host" -v /home/adminngumina:/zap/wrk:rw -t ictu/zap2docker-weekly zap-full-scan.py -t https://mysiteexample.local/ --hook=/zap/auth_hook.py -z auth.username="Ngumina" auth.loginurl=https://mysiteexample..local/#/login auth.username_field="username" auth.password_field="password" auth.password="Password" auth.submit_field="loginButton button button-md button-default button-default-md button-md-primary"

Error

RROR Permission denied 2020-01-23 14:44:03,136 I/O error(13): Permission denied Traceback (most recent call last): File "/zap/zap-full-scan.py", line 444, in main write_report(base_dir + report_json, zap.core.jsonreport()) File "/zap/zap_common.py", line 503, in write_report with open(file_path, mode='wb') as f: IOError: [Errno 13] Permission denied:

dicksnel commented 4 years ago

@n7902 does the directory "/home/adminngumina" have RW access?

Can you paste the full log?

n7902 commented 4 years ago

It does, and just to sanity check, I've tried a few other host directories which I know have RW.

And sure, are you looking for the full stack trace or for the zap.out logs from within the container?

dicksnel commented 4 years ago

Hi @n7902 I can replicate the issue and will make a fix.

dicksnel commented 4 years ago

@n7902 can you try running it with the param -u root in the Docker command?

n7902 commented 4 years ago

yep, that worked! I'll use that for now, thanks very my much

snehadominic commented 3 years ago

@n7902 Hi, can you please explain the fix for this issue? What does 'root' in '-u root' means? Is it the root folder. I had tried that and an error is thrown.

dicksnel commented 3 years ago

@snehadominic it means the container is started as root user.