mozilla / observatory-cli

Mozilla Public License 2.0
189 stars 24 forks source link

Improvement fo passing --min-score when printing report #42

Open danieldanielecki opened 5 years ago

danieldanielecki commented 5 years ago

Current Behaviour

Now if I run $ observatory MYDOMAIN.com --format report --zero --min-score 100 I got no logs for the report, there's error only if it fails. For passing there's simply nothing, the script passes. In both cases without printing the report. Only if I'll run $ observatory MYDOMAIN.com --format report --zero then I got:

HTTP Observatory Report: MYDOMAIN.com

Score Rule                           Description
  -10 content-security-policy        Content Security Policy (CSP) implemented, but allows 'unsafe-eval'.
    0 x-xss-protection               X-XSS-Protection header set to "1; mode=block".
    0 x-content-type-options         X-Content-Type-Options header set to "nosniff".
    0 cross-origin-resource-sharing  Content is visible via cross-origin resource sharing (CORS) files or headers, but is restricted to specific domains.
    0 public-key-pinning             HTTP Public Key Pinning (HPKP) header not implemented.
    0 redirection                    Initial redirection is to HTTPS on same host, final destination is HTTPS.
    0 contribute                     Contribute.json isn't required on websites that don't belong to Mozilla.
    0 strict-transport-security      HTTP Strict Transport Security (HSTS) header set to a minimum of six months (15768000).
    0 subresource-integrity          Subresource Integrity (SRI) not implemented, but all scripts are loaded from a similar origin.
    5 cookies                        All cookies use the Secure flag, session cookies use the HttpOnly flag, and cross-origin restrictions are in place via the SameSite flag.
    5 x-frame-options                X-Frame-Options (XFO) implemented via the CSP frame-ancestors directive.
    5 referrer-policy                Referrer-Policy header set to "no-referrer", "same-origin", "strict-origin" or "strict-origin-when-cross-origin".

Score: 105
Grade: A+

Now, to have combined report plus passing/failing based on minimal score I need to run one more command, i.e. $ observatory MYDOMAIN --min-score 100.

Expected Behaviour

Run $ observatory MYDOMAIN --format report --zero --min-score 100 and display the report plus show if the test passed or not.