Modernizing Web Authentication and Session Security

Modernizing Web Authentication and Session Security

The weak point on many legacy sites is the session, not the login form. A CTO-altitude read on passkeys, cookie attributes, and the lifecycle that ages badly.

The web authentication and session security model a site shipped on around three years ago is now a liability, and the weak point may not be the login form at all — it can be the session behind it. Cookie defaults now differ by browser, passkeys moved from a vendor commitment to a widely deployed option, and a long-lived, weakly-attributed session cookie is a gap worth checking first on a legacy enterprise site. This is a CTO-altitude read: where the risk actually sits, why authentication and session are architectural rather than a late hardening flag, and the posture you decide before engineering owns the build.

Why legacy session models age badly

A login form looks like the front door, so it gets the attention. The session is the corridor behind it that stays open after the door has been used, and that is where a site that has not been rebuilt in three years can be weakest.

Password-first authentication with loose cookie attributes was a common launch-era posture. It is a weak one now, and not because anything in the code broke. The rules and expectations around it moved. Chrome treats a cookie without a SameSite attribute as Lax by default, a change rolled out in stages during 2020 to Chrome 80 and later (paused from April 3 to July 14, 2020), according to the Chromium SameSite updates page. The same page notes that the change does not affect Chrome on iOS, and that a cookie that is Lax only by default can still be sent on a top-level cross-site POST request if it is at most two minutes old, an allowance it describes as temporary. Edge applies the same default from version 86, while, as of Oct 2026, Firefox and Safari do not apply it (Firefox offers it only behind a preference) — so a session that never set the attribute explicitly behaves differently depending on the visitor's browser. The assurance bar a customer's security review applies rose, and a strong-authentication option moved from a roadmap line to an expectation: Apple, Google, and Microsoft jointly committed to passkey support in May 2022, and the FIDO Alliance estimated in May 2026 that 5 billion passkeys were in use worldwide. A session that leaves these choices to whatever default each browser applies is relying on behavior no browser guarantees uniformly — it works in normal operation, which is exactly why the gap is invisible until it is exploited or audited.

There is an asymmetry in attention that explains why this gap is so durable. The login form is an obvious target for a security review and the part a redesign touches most visibly, so it gets scrutiny again and again. The session can go unredesigned, because it was never broken — it may have been taken from the platform default and carried forward through every release without a decision being made about it. A control that is never decided is never re-decided. A session model that no one has owned since launch is exactly the kind of thing a current security review now finds and a launch-era team never would have looked for, because at launch it was doing precisely what the framework intended.

The deeper reason legacy sessions age badly is that an untouched site carries the cookie and lifecycle defaults of its era frozen in place. Whatever the framework or platform set by default at launch is still what is set, because nobody had a reason to revisit it. That frozen default is not neutral. It is a decision made by not deciding, and the cost of it is paid on a day the CTO does not get to choose: an incident, or a procurement security review that will not sign until the session model is brought current. The first job here is to make the decision explicit so it can be priced before it is forced.

The identity shift

The identity layer moved structurally, not cosmetically, and the move has a clear direction a CTO can state without reading the implementation.

The modern primary factor is a passkey, built on the WebAuthn model, with the password demoted to a fallback rather than the default path. This is not a usability preference dressed up as security. A phishing-resistant factor bound to the origin removes an entire class of credential-replay and stuffing risk at the point where it originates, which is why it is now the expectation a serious security review assumes rather than a differentiator a vendor advertises. For the web tier, the federated and delegated-access patterns built on OAuth 2.0 and its identity layer are the standard plumbing, and multi-factor authentication is a baseline applied to privileged paths, not an upsell offered to security-conscious users.

The posture decision is not "adopt every factor everywhere." It is to know, per surface, what the modern expectation is and where the legacy site sits below it.

Authentication factorWhere it appliesThe modern expectation
Passkey / WebAuthnPrimary user sign-inThe default path, origin-bound, phishing-resistant
PasswordFallback onlyAllowed as recovery, never the only factor for sensitive access
Multi-factor (step-up)Privileged and high-risk actionsA baseline on the path, applied by risk, not offered as an option
Federated / delegatedThird-party and SSO accessStandard delegated-access flow, scoped, not a custom token scheme

Read this as a gap map, not a feature list. The CTO question is which rows the current site is below and which of those are load-bearing in its architecture — not which factors are available in the abstract. Service-to-service authentication, the back-channel between your platform and payment or partner systems, is a different surface owned by a separate topic on this site; what is in scope here is the session and login a browser participates in.

Session security attributes done right

Once a user is authenticated, the session cookie is the credential. Its attributes are not individual flags to toggle when a scanner complains — they are one coherent set that only works as a set, and treating them as separable is itself the legacy posture.

SameSite, the __Host- prefix, the Secure flag, and HttpOnly each close a different path, and a session is only as protected as the weakest one. SameSite constrains cross-site sending. __Host- requires the cookie to be set from a secure origin with Secure, Path=/ and no Domain attribute, which locks it to the host that set it and makes it apply across that whole host, so in browsers that support cookie prefixes a subdomain, a non-secure origin, or a cookie scoped to a narrower path cannot override it. Secure limits the cookie to HTTPS requests (except on localhost), and HttpOnly keeps page script from reading it, though the browser still attaches it to requests that script makes. A site that sets two of the four and not the other two has not partially solved the problem; it has left the path the other two would have closed fully open. The current attribute behavior is documented in the MDN Set-Cookie reference, and the gap between that reference and the defaults the site launched with is the gap a review now flags. Note that these attributes appear here as security controls on the session. Whether a cookie needs consent is a legal question that depends on jurisdiction, and a different topic owns it. In the EU, for example, Article 5(3) of the ePrivacy Directive requires Member States to ensure that storing information on, or gaining access to information already stored on, the device of a subscriber or user is allowed only with that person's consent, given after clear and comprehensive information, including about the purposes of the processing. It exempts technical storage or access for the sole purpose of carrying out the transmission of a communication over an electronic communications network, or as strictly necessary for the provider of an information society service explicitly requested by the subscriber or user to provide that service. Conflating the security question with the consent question is how sites end up addressing neither well.

Attributes alone are not the design, though. Session lifecycle is the other half, and on legacy sites it is the half that was never designed at all — it was inherited. A modern lifecycle is a named, owned thing: the session identifier rotates on a privilege change so a captured pre-escalation token is worthless after escalation, idle and absolute expiry are both set rather than relying on one, and revocation actually works server-side rather than depending on the client discarding a cookie it has no reason to discard. The reference posture for this is the OWASP Session Management Cheat Sheet, and the distance between it and an inherited default can be larger than the team assumes.

It is worth being precise about how a partial set comes about, because the reason determines the fix. Leaving two attributes off need not be a deliberate choice. It can be the compound result of a platform default that set some and not others at launch, and a scanner that flagged one missing attribute, got that one set, and closed the finding — so the cookie can end up carrying exactly the attributes that something complained about and none of the ones nothing did. That is why treating these as one coherent set is a posture decision and not a checklist item: a checklist closes the entries it lists, and the gap here is precisely the entry the checklist did not have.

A legacy gap worth checking first on untouched enterprise sites is one finding stated plainly: a long-lived session cookie with weak attributes and no real expiry or revocation. It persists because nothing about it fails in normal use, so nothing ever prompted the revisit. It is dangerous for the same reason — it is a wide, quiet credential that an attacker who obtains it once can use for as long as the site keeps honoring it, which on this configuration is effectively forever.

What a rebuild changes here

Authentication and session sit on the architectural side of the rebuild-versus-patch line, and that placement is the whole point of treating them at posture altitude rather than as a hardening pass.

Some security domains retrofit cleanly onto a running system — the architecture has no opinion about them, so improving them is a genuine fix. The session and identity model may not be one of those. When the original design assumed browser behavior that no longer holds, or when strong authentication cannot be added as a first-class path without changing how identity flows through the application, the gap is load-bearing in the architecture, not additive to it. You cannot patch your way to a posture the design was not built to hold; you can only wrap the requirement in a layer that passes today's check and fails the day it is actually tested. A wrapper over a changed default is not a fix that costs less — it is a delay that costs more, with the bill timed by an incident rather than by you.

This is why the decision belongs to the CTO and not to a technology preference. The framing is not "is the new auth stack better." It is: what is the residual risk if we retrofit the session model, what does rebuilding that domain properly cost against that risk, and is this one of the load-bearing domains that makes a site-wide patch a temporary illusion. The mechanics — how the new session model is actually constructed, how a passkey flow is implemented, how token rotation is wired — are deferred to engineering on purpose, because that depth rots faster than the decision does and the audience for this read is allocating risk and budget, not editing a module. The posture you own is narrower and more durable than the build: decide that authentication and session are architectural, audit where the current model sits below modern, and fund the load-bearing gaps before the cosmetic ones, regardless of which is the easier sentence to write.

Project Inquiry