Skip to content
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

Merged
merged 7 commits into from
Aug 30, 2018

Conversation

chigby
Copy link
Contributor

@chigby chigby commented Aug 28, 2018

Resolves #515

This pull request:

  1. Adds a check to the scanner for verifying that the Referrer-Policy header is set to no-referrer.
  2. Adds a field to the ScanResult model to save the status of that check as true or false (or null, meaning not checked).
  3. Adds a panel for viewing this field in the admin.
  4. Adds a 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.

@chigby chigby requested a review from harrislapiroff as a code owner August 28, 2018 16:35
@eloquence eloquence self-requested a review August 28, 2018 17:37
Copy link
Member

@eloquence eloquence left a 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.

@@ -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()
Copy link
Member

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).

Copy link
Contributor Author

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.

@conorsch conorsch self-requested a review August 29, 2018 23:51
Copy link
Contributor

@conorsch conorsch left a 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!

@conorsch
Copy link
Contributor

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).

@conorsch conorsch force-pushed the 515-referrer-policy branch from b3e37ff to ed8d91e Compare August 29, 2018 23:56
@conorsch conorsch merged commit dab6415 into master Aug 30, 2018
@conorsch
Copy link
Contributor

Deployed.

@chigby chigby deleted the 515-referrer-policy branch August 19, 2019 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants