This repository has been archived by the owner on Dec 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
Making the trustymail PSL cache read-only in Lambda #215
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
776bfac
Making the PSL cache read-only when running in AWS Lambda
jsf9k 37687cf
Changing the order of the trustymail imports.
jsf9k 3d04532
Merge branch 'master' into feature/tmail_psl_cache_readonly_in_lambda
jsf9k f15e2ee
Merge branch 'master' into feature/tmail_psl_cache_readonly_in_lambda
konklone f1f599c
Merge branch 'master' into feature/tmail_psl_cache_readonly_in_lambda
jsf9k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move the import statements to within the code, instead of at the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The monkey patching can only happen here, since at the top of the file we don't know if we're running locally or in Lambda. The
import trustymail.trustymail as tmail
statement has to happen after the monkey patching, since otherwise it doesn't appear to have any effect ontmail.scan
. (I spent quite a while debugging this very issue yesterday!)I could put
import trustymail
and monkey patch for running locally at the top of the file, then re-patch inside the function if we're running in Lambda. Theimport trustymail.trustymail as tmail
statement would still have to be inside the function though (since it has to come after the monkey patching), and I thought the code would be easiest to understand if I just kept everything together.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, got it.
This is your scanner and I'm happy to see this merged to support the change, but I left a comment over at cisagov/trustymail#74 about whether a new flag is necessary for this purpose.
We could also look at aligning the placement of the PSL to be inside
cache/
for the Lambda function, which would eliminate the need for special-case code inside thetrustymail
scanner at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I responded to your comment over on cisagov/trustymail#74, but I'll include it here too:
I agree that moving the PSL to be inside of the
cache
directory would be a good change to make. I can add that to this pull request or make a separate one if you like.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To copy my latest comment from that thread here too, for those reading:
I also filed #219 to capture some comments around repackaging the PSL and other third party data sources in scanners.