Join our Newsletter — 33% off our NHI Course
Home› Guides› Web Application Hardening Checklist: Headers, Sessions, Cookies and…
Template Web & API Security

Web Application Hardening Checklist: Headers, Sessions, Cookies and Errors

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 14 November 2026 13 min read
On this page

Most web application hardening failures found in penetration tests and external scans are deployment settings, not code flaws: a missing header, a session cookie without HttpOnly, a stack trace on a 500 page, TLS 1.0 still enabled on one load balancer. This checklist is the go-live and periodic review run sheet for those settings. Every check has an explicit pass criterion that can be verified from an HTTP response, a configuration file or a scanner report, and most are traced to an OWASP ASVS 5.0 requirement so the result doubles as verification evidence. It covers transport and TLS, response headers, cookies, session management, error handling and information leakage. It is written for application security engineers, platform teams and release managers. The reasoning behind each header and its values is in the Security Headers Guide; this page is the list you test against.

How to use this template

  • Replace every [placeholder]. Run the checklist per application and per hostname: headers and TLS settings often differ between the main site, the API host, the login host and static content domains.
  • Test the deployed response, not the code or the intended configuration. A CDN, reverse proxy or framework default can add, remove or override a header after your application sets it.
  • Check at least three response types per host: an authenticated HTML page, an unauthenticated page and an error response (a 404 and a forced 500 in a test environment). Many headers are set only on success responses.
  • Mark each line Pass, Fail, Partial or Not applicable, with evidence (a saved response header dump, scanner output, configuration excerpt or ticket reference). "Not applicable" needs a one-line reason.
  • Run the full list before first go-live, after any change of web server, CDN, framework or identity provider, and at least [annually]; run sections 2 and 3 on every release through an automated header check in the pipeline.

1. Review record

FieldEntry
Application name and inventory ID[name]; [ID from your application or API Inventory Template register]
Hostnames in scope[www.example.com, login.example.com, static.example.com]
Front door components[CDN, WAF, load balancer, reverse proxy, application server]
Target ASVS level[L1 / L2 / L3]; see the OWASP ASVS Guide
Session mechanism[Server-side session cookie / self-contained token / identity provider session plus application session]
Reviewer, date, overall result[Name], [date], [Pass / Pass with findings / Fail]

2. Transport and TLS

#CheckPass criterionASVS 5.0Result and evidence
2.1Only current TLS versions are enabledTLS 1.2 and TLS 1.3 only, TLS 1.3 preferred; SSL 3.0, TLS 1.0 and TLS 1.1 refused on every listenerV12.1.1[ ]
2.2Only recommended cipher suites are offeredStrongest suites preferred; no NULL, export, RC4 or 3DES suites; forward secrecy only for L3V12.1.2[ ]
2.3No plaintext fallbackHTTP on port 80 only redirects to HTTPS and serves no content or cookiesV12.2.1[ ]
2.4Publicly trusted certificateCertificate chains to a public CA, covers every hostname in scope, expiry monitored with an ownerV12.2.2[ ]
2.5HSTS on every responseStrict-Transport-Security present on all HTTPS responses with max-age of at least 31536000 (one year); includeSubDomains for L2 and aboveV3.4.1[ ]
2.6HSTS preload (L3 or by decision)Top-level domain is on the browser preload list, after confirming every subdomain serves HTTPSV3.7.4[ ]

Server-side protocol and cipher detail sits in the TLS Server Configuration Baseline Guide. Preload is hard to undo, so read HSTS and HSTS Preload before submitting a domain.

3. Response headers

#HeaderPass criterionASVS 5.0Result and evidence
3.1Content-Security-PolicyPresent on HTML responses; includes object-src 'none' and base-uri 'none'; scripts controlled by an allowlist, nonces or hashes; no 'unsafe-inline' for scripts without a nonce or hash. L3: per-response nonces or hashesV3.4.3[ ]
3.2CSP frame-ancestorsSet on every response; 'none' or 'self' unless embedding is a documented requirement. X-Frame-Options: DENY may be added for older clients but is not relied onV3.4.6[ ]
3.3CSP reporting (L3 or by decision)A report-to or report-uri endpoint is defined and its reports are reviewedV3.4.7[ ]
3.4X-Content-Type-Optionsnosniff on all responses, and every response with a body has a correct Content-Type including charsetV3.4.4, V4.1.1[ ]
3.5Referrer-PolicySet explicitly, for example strict-origin-when-cross-origin or stricter; no-referrer for internal applications whose hostnames or URLs are sensitiveV3.4.5[ ]
3.6Cross-Origin-Opener-Policysame-origin (or same-origin-allow-popups where login pop-ups need it) on document responsesV3.4.8[ ]
3.7Access-Control-Allow-OriginFixed value or validated against an allowlist; never reflects arbitrary Origin; * only on responses with no sensitive data and never with credentialsV3.4.2[ ]
3.8Permissions-PolicyFeatures the application does not use are disabled, for example camera=(), microphone=(), geolocation=()Not an ASVS requirement[ ]
3.9Cache-Control on sensitive responsesno-store on authenticated pages and API responses carrying personal or secret data (no-cache alone still allows storage)V14.3.2[ ]
3.10Legacy and fingerprinting headersX-XSS-Protection absent or set to 0; X-Powered-By removed; Server removed or generic; no backend version strings (L3)V13.4.6[ ]

The recommended values for 3.5, 3.6, 3.8, 3.9 and 3.10 follow the OWASP HTTP Headers Cheat Sheet. Policy design for 3.1 is covered in the Content Security Policy Guide, and 3.7 in the CORS Misconfiguration Guide.

4. Cookies

Inspect every Set-Cookie header the application, its framework and its front door emit, including those set by load balancers for stickiness and by the identity provider on the login host. A target baseline for a session cookie, as given in the OWASP Session Management Cheat Sheet, is Set-Cookie: __Host-id=<value>; Secure; HttpOnly; SameSite=Strict; Path=/ (or SameSite=Lax where top-level cross-site navigation must carry the session).

#CheckPass criterionASVS 5.0Result and evidence
4.1Secure attribute and prefixEvery cookie has Secure and is named with __Host- or, where sharing across hosts is needed, __Secure-V3.3.1[ ]
4.2Host-only by default__Host- used unless the cookie is explicitly designed to be shared; no Domain attribute on session cookiesV3.3.3[ ]
4.3HttpOnly on tokensSession and other script-inaccessible cookies carry HttpOnly, and the session value is sent only in Set-Cookie (never in a response body or URL)V3.3.4[ ]
4.4SameSite set explicitlyStrict or Lax chosen per cookie purpose and set explicitly, not left to browser defaults; None only with Secure and a documented cross-site needV3.3.2[ ]
4.5Non-persistent session cookieNo Expires or Max-Age beyond the session lifetime; timeouts enforced on the server, not by cookie expiryV7.3.1, V7.3.2[ ]
4.6Generic name and opaque valueSession cookie name does not reveal the framework (not PHPSESSID or JSESSIONID); value is opaque and contains no personal dataNot an ASVS requirement[ ]

Attribute behaviour, prefixes and partitioned cookies are explained in the Cookie Security Guide. SameSite supplements, and does not replace, CSRF protection: see the CSRF Prevention Guide.

5. Session management

#CheckPass criterionASVS 5.0Result and evidence
5.1Timeouts documented and justifiedInactivity timeout and absolute lifetime written down per application, with justification for any deviation from NIST SP 800-63B reauthentication guidanceV7.1.1[ ]
5.2Inactivity timeout enforced server sideIdle session rejected after [ ] minutes; tested by replaying a captured request after the periodV7.3.1[ ]
5.3Absolute lifetime enforcedSession rejected after [ ] hours regardless of activityV7.3.2[ ]
5.4New session on loginSession identifier changes on authentication and reauthentication; the old identifier no longer worksV7.2.4[ ]
5.5Logout really ends the sessionAfter logout or expiry, a replayed request with the old cookie or token is rejected; for self-contained tokens, a revocation list, per-user cut-off time or key rotation is in placeV7.4.1[ ]
5.6Disabled accounts lose sessionsDisabling or deleting a user terminates all of that user's active sessionsV7.4.2[ ]
5.7Administrators can terminate sessionsAn administrator can end all sessions for an individual user or for all usersV7.4.5[ ]
5.8Sensitive changes need reauthenticationChanging email address, phone number, MFA settings or account recovery details requires full reauthenticationV7.5.1[ ]
5.9Session identifier strengthReference tokens are unique, generated by a CSPRNG and carry at least 128 bits of entropy (the OWASP cheat sheet sets 64 bits as the absolute floor)V7.2.3[ ]

For timeout values, OWASP's cheat sheet gives common idle timeouts of 2 to 5 minutes for high-value applications and 15 to 30 minutes for low-risk ones; set yours from risk and record it in 5.1. NIST SP 800-63B-4 requires session cookies to be Secure and recommends HttpOnly, __Host-, Path=/ and SameSite Lax or Strict, consistent with section 4. Fixation and token handling are covered in the Session Fixation Guide and Token and Session Security Guide.

6. Error handling and information leakage

#CheckPass criterionASVS 5.0Result and evidence
6.1Generic error responsesA forced 500 and a malformed request return a generic message with a correlation ID; no stack trace, SQL, file path, secret, token or framework versionV16.5.1[ ]
6.2Last resort handlerA global exception handler catches all unhandled exceptions, logs the detail server side and keeps the process runningV16.5.4[ ]
6.3Fail closedAn exception in validation or authorisation logic stops the transaction rather than letting it proceedV16.5.3[ ]
6.4Correct status codes4xx for client errors, 5xx only for server faults; API errors use a consistent structured format such as application/problem+json (RFC 9457) without internal detailNot an ASVS requirement[ ]
6.5Debug modes offFramework debug pages, developer exception pages, verbose logging to the client and debug toolbars disabled in production for every componentV13.4.2[ ]
6.6No source control metadataRequests for /.git/, /.svn/ and similar return 404 or 403V13.4.1[ ]
6.7Internal documentation and monitoring not exposedAPI documentation consoles, health, metrics and actuator endpoints unreachable from the internet unless intended and authenticatedV13.4.5[ ]
6.8Default and sample content removedWeb server and framework welcome pages, sample applications and directory listings disabledNot an ASVS requirement[ ]

The OWASP Error Handling Cheat Sheet names the framework hooks for 6.2, for example @RestControllerAdvice in Spring and UseExceptionHandler in ASP.NET Core. Logging the detail you no longer show the user is covered in the Secure Error Handling and Logging Guide.

7. Findings and sign-off

Check #FindingSeverityOwnerFix or exception (with expiry)Retest date
[3.1][CSP missing on error pages][Medium][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]

Go-live decision: [Approved / Approved with exceptions / Not approved]. Signed: [application owner], [security reviewer], [date].

Implementation guidance

Rolling out fixes without breaking production

  1. Baseline first: capture the current response headers and cookies for every hostname and the three response types, and store them as evidence. This is your rollback reference.
  2. Decide where each control lives: set transport, HSTS, generic headers and fingerprint removal once at the CDN or reverse proxy; set CSP, cookies, session and error behaviour in the application, where they can vary per route. Record the choice so a later change of CDN does not silently drop headers.
  3. Use report-only modes: deploy CSP as Content-Security-Policy-Report-Only and review violations for [two weeks] before enforcing. Start HSTS with a short max-age (for example one day), raise it after a clean week, then to one year.
  4. Change cookies and timeouts in a pilot ring: renaming a session cookie or adding a __Host- prefix logs everyone out; tightening SameSite can break single sign-on returns and payment redirects. Test identity provider and payment flows explicitly.
  5. Automate regression checks: add a pipeline step that requests key URLs and fails the build if a required header, cookie attribute or generic error page is missing.
  6. Roll back by setting, not by release: keep each header and cookie change behind its own configuration value so one breaking setting can be reverted without undoing the rest. HSTS and preload are the exception: they persist in browsers, which is why they ramp slowly.

Decision guidance

  • Which ASVS level: L1 checks (2.1, 2.3 to 2.5, 3.7, 4.1, 5.4 to 5.6) are the floor for anything internet-facing. Use L2 for applications handling personal or financial data; L3 adds per-response CSP nonces, CSP reporting, COOP, preload and version hiding.
  • Strict or Lax: choose SameSite=Strict for session cookies on applications that users reach directly; Lax where users arrive from links in email or other sites and must stay logged in.
  • Small teams: a managed CDN or platform that injects headers and terminates TLS covers most of sections 2 and 3; spend the effort on sections 4 to 6, which only the application can get right.

Metrics

  • Header pass rate: percentage of in-scope hostnames passing every section 3 check on the latest automated scan.
  • Cookie compliance: percentage of observed cookies with Secure, an approved prefix and explicit SameSite.
  • Legacy TLS exposure: count of listeners accepting TLS 1.1 or below (target zero).
  • Error leakage: count of responses in scanner or log samples containing stack traces or framework versions.
  • Exception age: number of open hardening exceptions past their expiry date.

Common failure patterns

  • Headers only on 200 responses: error pages served by the proxy or framework miss CSP and HSTS.
  • The CDN strips or overrides: the application sets a header that the edge replaces, so code review passes and the live test fails.
  • Logout that only deletes the cookie: the server-side session or token remains valid and replay works.
  • CSP with 'unsafe-inline' and wide wildcards: the header is present, the scanner is satisfied and script injection still runs.
  • Staging hosts left on debug: internet-reachable pre-production systems leak stack traces and configuration.

Framework mapping

FrameworkReferenceChecklist sections
OWASP ASVS 5.0V3 Web Frontend Security; V7 Session Management; V12 Secure Communication; V13.4 Unintended Information Leakage; V16.5 Error Handling2 to 6
NIST SP 800-53 Rev. 5SC-8 Transmission Confidentiality and Integrity; SC-23 Session Authenticity; AC-12 Session Termination; SI-11 Error Handling; CM-6 Configuration Settings; CM-7 Least Functionality2; 4 and 5; 5; 6; 3; 6
NIST CSF 2.0PR.PS-01 Configuration management; PR.DS-02 Data in transitAll; 2
MITRE ATT&CKT1190 Exploit Public-Facing ApplicationReduces exposed weakness and reconnaissance detail on public-facing applications

Standards and references

Related NHI Mgmt Group resources: Security Headers Guide, Web Application Security Guide, OWASP ASVS Guide, Web Application Firewall Guide.

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.