-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the Referrer-Policy header in the scanner #530
Conversation
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.
Looks good from my end and does what it says, though I would suggest renaming the new field, see comment.
directory/models/entry.py
Outdated
@@ -270,6 +270,7 @@ class ScanResult(models.Model): | |||
cache_control_nostore_set = models.NullBooleanField() | |||
cache_control_private_set = models.NullBooleanField() | |||
expires_set = models.NullBooleanField() | |||
no_referrer_policy_set = models.NullBooleanField() |
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.
Would you mind renaming this to be less ambiguous? Note that in the UI, it is displayed as "No referrer policy set", which could be interpreted as, "this landing page has no referrer policy" (especially in the context of other "No" fields like no_analytics
) , when what you really mean is "this landing page's referrer policy is set to no-referrer
", the exact opposite. I would suggest referrer_policy_set_to_no_referrer
(long but not ambiguous).
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.
This is a good point, I'll make the change.
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.
LGTM, let's get it out there and take it for a spin!
Incoming rebase to satisfy branch-out-of-date checks (which we keep enabled on web repos to avoid migration conflicts that git can't catch). |
We verify that it's set to "no-referrer" only.
Includes migration for this field.
With the previous name, it was not clear if the policy header was not set at all, or if it was set to the correct value of `no-referrer`. So this new name makes it clear what we want.
b3e37ff
to
ed8d91e
Compare
Deployed. |
Resolves #515
This pull request:
no-referrer
.ScanResult
model to save the status of that check as true or false (or null, meaning not checked).ResultState
for this new field. I wasn't totally sure if this was necessary or if there are other things needed for this, but it looks like the other scan parameters have data here so I adapted one from another header-based scan field. If there's something else that should be done here, please let me know.Note: I added unit tests for the scanner function but they are not VCR based: I adapted pre-existing test code for checks that were doing something very similar to this one. I was looking over the code and didn't see any VCR tests for these sorts of scanning/validation methods. I can write some if you want, but I didn't want to color too far outside the lines, as it were.