You sign in to an invoice portal, open one invoice and then another. You do not enter your password for every page. It feels as though the website remembers one continuous visit, even though your browser sends separate requests as you work. The browser is the program displaying the site on your computer; the server is the computer answering for the service. Each request asks it to provide something or perform an action. 26

The next request does not, by itself, tell the service that it belongs to the visit you just signed in to. The application—the service’s own program—must connect the requests with that visit. The service keeps track of this signed-in visit, called a session. A common way to support it is a cookie: a small piece of information the website asks your browser to keep and send back with suitable requests. 26 11

For example, after accepting your sign-in, the service can create a session record and return a cookie containing an unpredictable identifier for it. The browser stores that value. When you next request an invoice, it can attach the cookie automatically. The service looks up the associated session, recognizes the signed-in account, and then must check whether that account may read the selected invoice. The cookie usually need not contain your password or the invoice itself; in this arrangement it connects the request to a record kept by the service. 11 26

Notice both sides of the mechanism. The browser follows rules about when to send the stored value. The application decides what the value means and whether the associated session is still valid. If somebody obtains a usable login cookie, it may let them act through that session without knowing the original password. That is why its handling matters and why a session cookie should not be pasted into an email asking for support. 11

Think of a cloakroom ticket. The ticket is not the coat, but it helps the attendant connect a returning visitor with an earlier transaction. A session cookie can similarly help a service connect requests with a signed-in session. The analogy has a limit: the service still needs to check what that session is entitled to do. Possessing a session identifier must not mean access to every customer’s records.

Cookies have different purposes. One may remember a display preference; another may help identify a signed-in user. Before treating a warning as an account-security problem, we need to know which purpose the cookie serves. A name alone is not enough to establish that role. 11

HTTPS means that the browser and server protect their connection with encryption, keeping a mere observer from reading the travelling information. A cookie identifies a session only if the application uses it for that purpose; encryption protects its journey rather than deciding its meaning. 25 11

A cookie can come with instructions about how the browser should handle it. The setting called Secure restricts transmission to HTTPS requests in normal website use; the local testing address localhost has a special exception. It protects a route by which the cookie travels. It does not itself decide which person is signed in or what that person may see. 11

The page can also contain a program: instructions carried out by the browser. Such a program is called a script. It might ask for the next invoice after you click a button. A restriction on a script reading a stored cookie is therefore different from a restriction on the browser using that cookie when carrying out a request. 25 11

Another setting, HttpOnly, prevents page scripts — programs running within the page — from reading the cookie through the browser’s script interfaces. This is useful for a login cookie that those scripts do not need to read. But the browser can still send that cookie with a request started by a script. Preventing a script from reading the ticket is not the same as preventing the browser from presenting it. 11

That distinction explains why the settings complement rather than replace one another. It also explains why a preference cookie designed for scripts to read is not automatically a security failure merely because it lacks HttpOnly. Its purpose matters.

What happens when another site starts the journey?

You might reach the portal by following a link from another website or through an external sign-in service. A cookie setting called SameSite influences when cookies accompany requests that cross between sites. This helps limit some unwanted cross-site activity, but it must fit the intended login and navigation flow. 11

Here is the unwanted behaviour these restrictions can help with. While you are signed in to the portal, you visit another website. That page tries to make your browser send a request to the portal. If the browser automatically adds your login cookie, the portal might recognize the request as coming from your signed-in session, although you never intended that action. A suitable SameSite rule can keep the cookie off some cross-site requests. The application also needs its own protection against unwanted actions; this setting is not a complete replacement for that work. 11 12

Strict is restrictive about cross-site use. Lax also allows certain top-level navigations, such as qualifying visits reached by following a link. None permits cross-site use under this rule and requires Secure. It does not override all browser privacy restrictions: SameSite=None is not a guarantee that the cookie will be sent in every situation. 11 12

Cookies also have a reach. A cookie limited to the host that set it is narrower than one deliberately made available to that domain and its subdomains. A path setting can limit when the browser sends it, but it is not a reliable security wall between different sections of a website. These details belong with the developer; the understandable design question is whether the login cookie needs to travel as widely as it does. 11

Finally, closing a browser is not necessarily logging out. Some browsers restore session cookies when they restore the previous browsing session. The application needs its own clear behaviour for ending access; the disappearance of a window does not demonstrate that the service stopped recognizing the session. 11

A separate question: may another page read the answer?

Now suppose a page needs data from another web address. Browsers group web addresses by their origin: the HTTP or HTTPS part, the host name, and the connection port number. For example, https://portal.example and https://support.example have different origins because their host names differ. The same company can operate both without making them the same origin. Browser rules restrict how scripts read responses from another origin. A mechanism called Cross-Origin Resource Sharing, or CORS, lets the responding service state when that reading is allowed. 2 12

Why restrict reading at all? Otherwise, a page you happen to visit could ask your browser for private information from another service you are already using and then read the answer. The legitimate sign-in at that second service is not permission for an unrelated page to learn the result. Browsers therefore separate the page making the request from the service answering it. “Different origin” is this technical separation, not a judgment about which company is trustworthy. The port mentioned above is a connection number used to distinguish services, often implicit in a normal address. Cookies’ “same site” grouping is not identical to this origin grouping; two subdomains can be part of one site while still having different origins. 12 11

Continue with a permitted accounting dashboard and a separate invoice service. The dashboard’s script asks that service for a document. The service checks the customer’s access and, in its response, states whether this dashboard’s origin may receive the answer through browser scripts. The browser checks that permission before giving the script access to the response. Those are two separate decisions: the server’s decision about the customer and the browser’s decision about sharing the answer with another page. 12 2

For example, a public exchange-rate service might intentionally let many websites read its rates. An invoice service returns private information instead. Its computer must check who is asking and whether that person may access the requested invoice. CORS does not perform those checks: it governs sharing with browser scripts, not a customer’s identity or ownership of a document. Software outside a browser is not constrained in the same way. 2 12

This is why “only our website is allowed by CORS” is not an adequate answer to “How do you stop one customer reading another customer’s invoice?” The application must enforce that access decision independently.

You may also see an asterisk in a CORS report. It means a broad permission to share, but it needs context. When a page asks the browser to include credentials such as cookies on a request to another origin, it uses a mode called include. In that mode, the asterisk is not accepted as permission to share the response, even if the service also says credentials are allowed. A matching explicit origin is required. That combination of headers alone is therefore not proof that an attacker can read signed-in users’ data. It is not a clean bill of health either: a different configuration that accepts an untrusted origin can create a genuine concern. 2 12

Reading and doing are different

A browser can refuse to let another page’s script read an answer even though a request has already reached the service. For certain kinds of request, the browser needs permission before sending the main request. It can first ask the other service whether it permits that kind of exchange; this preliminary exchange is often called a preflight. Other requests do not need it. Consequently, blocking response reading does not prove that the service received nothing or changed nothing. CORS is not a complete defence against tricking a signed-in browser into sending an unwanted request. 2 12

For the business owner, keep three questions separate: how does the service recognize the session, what may that user do, and which other pages may read responses through the browser? Cookie settings help with the first, application access checks answer the second, and CORS concerns the third.

Never send a live session cookie to someone as evidence: it may support access to your account. Ask for an explanation without the secret value. If the behaviour needs testing, it should be done with permission, made-up accounts and documents in a test environment — not by trying to open another customer’s real invoice.

Sources

[2] WHATWG: Fetch Standard

[11] MDN: Set-Cookie

[12] MDN: Cross-Origin Resource Sharing

[25] MDN: How the web works

[26] MDN: An overview of HTTP