Security Auditor — reads every
Set-Cookie header the audited URL sends and checks that each cookie carries HttpOnly, Secure (on HTTPS), a valid SameSite and well-formed Domain and Path attributes.Protection
Keeps session and login cookies away from page scripts, plain-HTTP eavesdroppers and requests started by other sites.
Standards
Follows RFC 6265 (HTTP State Management Mechanism) and the
SameSite attribute from its revision in progress, draft-ietf-httpbis-rfc6265bis.Set-Cookie attributes HttpOnly, Secure and SameSite close those three doors, and Domain and Path must be well-formed or browsers drop the cookie altogether. This auditor inspects every Set-Cookie header of the audited URL and reports one finding per cookie and attribute.
How it works
- Fetch — sends a
HEADrequest (orGETwhenHEADis not supported) to the audited URL as 37AuditsBot. A blocked request ends the audit with590; any other failure (timeout, DNS, TLS, or an HTTP status of 400 or more) ends it with500. - Parse — reads every
Set-Cookieheader in order and parses each one once into its name, value and theSecure,HttpOnly,SameSite,Domain,PathandExpiresattributes (attribute names are case-insensitive). - Rules — every rule runs over the whole list and emits one check per offending cookie, naming the cookie in the message, the recommendation and the check data. A cookie without
HttpOnly(400) or withSameSite=Nonebut noSecure(401) fails. A missing (300) or unknown (301)SameSite, a cookie set over HTTPS withoutSecure(302), aDomainwithout a dot (303), aPaththat does not start with/(304) and an emptySet-Cookieheader (305) warn. - Aggregate — FAIL wins over WARNING; when no cookie triggers any rule, or the page sets no cookie at all, the audit is
SUCCESS(200) and the message lists the cookie names. - Specification pin — every run emits
37A-CookieAuditor-100(INFORMATION), naming RFC 6265, HTTP State Management Mechanism (April 2011) and noting thatSameSitecomes from draft-ietf-httpbis-rfc6265bis. It does not change the overall status.
What it audits
Every row maps to onecheckRule* method and one CheckCode, in the order the auditor runs them. CheckCode suffixes use status ranges: 100 information, 200 success, 300–399 warning, 400–499 fail, 500–599 error. Per-cookie rules emit one check per offending cookie; {name} is the cookie name and {url} the audited URL.
Output documentation
Each per-cookie check carries
cookieName, secure, httpOnly, sameSite, domain, path, expires (the parsed value or null) and attribute (the attribute the rule is about) in its data; the empty-header check adds position. The 200 check carries cookieCount and cookieNames.
Risks and considerations
Why cookie attributes matter
- A session cookie readable by JavaScript is the first thing a cross-site scripting payload exfiltrates;
HttpOnlymakes it invisible to scripts. - Without
Secure, the same cookie is sent when anything on the page or a visitor’s typed address falls back tohttp://, where it can be read on the network. SameSitedecides whether the cookie accompanies requests started by other sites, which is what cross-site request forgery relies on. Browsers default differently when it is missing, so an explicit value gives every visitor the same protection.
Severity
- A missing
HttpOnlyand aSameSite=NonewithoutSecurefail; browsers reject the latter outright, so the feature that depends on it breaks. - A missing
Secureon HTTPS is a warning: many frameworks add it automatically behind a proxy, but confirm it reaches the browser. - Cookies that must be read by page scripts (a CSRF token for a JavaScript client, a theme preference) legitimately lack
HttpOnly. The auditor cannot tell them from session cookies, so review the finding for each cookie name.
Behavior changes from the previous version
- A network error or an HTTP status of 400 or more on the audited page is now
ERROR(500), notFAIL: it means the audit could not run, not that the site is wrong. HttpOnlystays aFAILandSecurestays aWARNING, as before.- Each finding now carries a
CheckCode, the cookie name and a recommendation; findings are no longer keyed by the rawSet-Cookiestring.
What this auditor does not check
- Only the audited URL is fetched, with a
HEAD(orGET) request and no login: cookies set after sign-in, by other pages or by JavaScript (document.cookie) are not seen. ExpiresandMax-Ageare recorded but not judged; cookie lifetime is a policy decision.- Cookie prefixes (
__Host-,__Secure-) and thePartitionedattribute are not validated. - A
Domainwith a leading dot is accepted; modern browsers ignore the dot.