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

"Strictly Forces HTTPS" can sometimes be null #176

Open
chigby opened this issue Sep 17, 2018 · 0 comments
Open

"Strictly Forces HTTPS" can sometimes be null #176

chigby opened this issue Sep 17, 2018 · 0 comments

Comments

@chigby
Copy link

chigby commented Sep 17, 2018

Hi,

I've noticed that for some sites I'm scanning, the Strictly Forces HTTPS field is sometimes null. I suspect this is for similar reasons as #49.

Here's a representative example:

pshtt --json https://projects.houstonchronicle.com/newstips/

results in (some fields snipped for brevity):

[
  {
    "Live": true,
    "Redirect": false,
    "Redirect To": null,
    "Strictly Forces HTTPS": null,
    "Unknown Error": false,
    "Valid HTTPS": true,
    "endpoints": {
      "http": {
        "live": true,
        "redirect": null,
        "redirect_immediately_to_external": null,
        "redirect_immediately_to_http": null,
        "redirect_immediately_to_https": null,
        "redirect_immediately_to_subdomain": null,
        "redirect_immediately_to_www": null,
        "status": 200,
        "unknown_error": false,
        "url": "http://projects.houstonchronicle.com/newstips/"
      },
      "https": {
        "live": true,
        "redirect": null,
        "redirect_immediately_to": null,
        "redirect_immediately_to_external": null,
        "redirect_immediately_to_http": null,
        "redirect_immediately_to_https": null,
        "redirect_immediately_to_subdomain": null,
        "redirect_immediately_to_www": null,
        "status": 200,
        "unknown_error": false,
        "url": "https://projects.houstonchronicle.com/newstips/"
      },
      "httpswww": {
        "live": false,
        "redirect": null,
        "redirect_immediately_to": null,
        "redirect_immediately_to_external": null,
        "redirect_immediately_to_http": null,
        "redirect_immediately_to_https": null,
        "redirect_immediately_to_subdomain": null,
        "redirect_immediately_to_www": null,
        "status": null,
        "unknown_error": false,
        "url": "https://www.projects.houstonchronicle.com/newstips/"
      },
      "httpwww": {
        "headers": {},
        "live": false,
        "redirect": null,
        "redirect_immediately_to": null,
        "redirect_immediately_to_external": null,
        "redirect_immediately_to_http": null,
        "redirect_immediately_to_https": null,
        "redirect_immediately_to_subdomain": null,
        "redirect_immediately_to_www": null,
        "status": null,
        "unknown_error": false,
        "url": "http://www.projects.houstonchronicle.com/newstips/"
      }
    }
  }
]

My theory is that this is due to not being strict (no pun intended) with booleans in the code here, where we have

def down_or_redirects(endpoint):
        return ((not endpoint.live) or endpoint.redirect_immediately_to_https)

which will return None if live = True and redirect_immediately_to_https = None, since this evaluates to False or None, which is itself None. Very similar to #49.

Anyway, thanks for reading. Hope this all makes sense. There is a comment on the other ticket about wanting all fields to be either true or false, so I think this issue could be considered a bug under that definition.

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

No branches or pull requests

1 participant