18F / domain-scan

A lightweight pipeline, locally or in Lambda, for scanning things like HTTPS, third party service use, and web accessibility.
Other
370 stars 137 forks source link

public-suffic-list.txt deployed to the wrong local path #250

Closed buckley-w-david closed 6 years ago

buckley-w-david commented 6 years ago

Hello,

In attempting to deploy and use the pshtt scanner to lambda, I encountered what I believe to be a bug.

The default "domain-scan" env package has the "public-suffic-list.txt" file in the root of the zip, and so the deployed pshtt zip file does as well.

However the pshtt scanner does not expect the file to be in the location, it expects it to be at "./cache/public-suffix-list.txt" as seen from the section of scanners/pshtt.py

. . .
# In Lambda, we package a snapshot of the PSL with the environment.
lambda_support = True
lambda_suffix_path = "./cache/public-suffix-list.txt"
. . .

As such when I deployed the scanner, and tried to use it, it failed, and the following failure was logged in CloudWatch:

[Errno 2] No such file or directory: './cache/public-suffix-list.txt': FileNotFoundError
Traceback (most recent call last):
File "/var/task/lambda_handler.py", line 29, in handler
data = scanner.scan(domain, environment, options)
File "/var/task/scanners/pshtt.py", line 79, in scan
suffix_list = codecs.open(lambda_suffix_path, encoding='utf-8')
File "/var/lang/lib/python3.6/codecs.py", line 895, in open
file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: './cache/public-suffix-list.txt'
jsf9k commented 6 years ago

This issue should be corrected in dhs-ncats/lambda_functions. You may prefer to use that project to build your own zip files for AWS Lambda.

buckley-w-david commented 6 years ago

Closing due to #252