---
title: "Session security for internal apps: cookies, tokens and why \"just use a password\" isn't enough"
description: "The login screen is the part everyone sees, but the session is what keeps a colleague signed in afterwards, and that is where quick internal tools usually go wrong. What OWASP, NIST and MDN say about sessions (cookie flags, a new session ID at login, idle and absolute timeouts, ending the session on the server), five common session mistakes in self-built apps, and how cyantula keeps the session at the gateway, out of the app, and ends it everywhere when somebody is switched off."
url: "https://cyantula.app/blog/session-security-internal-apps/"
updated: "2026-11-23"
---

23 November 2026

Somebody builds a small internal tool for the planning team. It gets a login page with a password, and that feels like security done. Three months later a colleague leaves, and their laptop still opens the tool without asking for anything. Nobody changed the password, because nobody had to: the app stopped asking for it on day one.

That is the part of authentication most people never think about. A password, or any login, proves who you are once. Everything after that runs on the session: a small token, usually in a cookie, that the browser sends with every request. If that token can be stolen, reused or simply never ends, the strength of the login hardly matters.

### What the guidance says

The [OWASP Top 10:2025](https://owasp.org/Top10/2025/A07_2025-Authentication_Failures/) keeps Authentication Failures at number 7, and several of its listed weaknesses are about sessions, not passwords: a session identifier in the URL, the same identifier reused after login, and sessions or tokens that are not invalidated at logout or after a period of inactivity. Its advice is to use a server-side, built-in session manager that issues a new random session ID after login, and ideally a premade, well-trusted system for authentication, identity and session management.

The [OWASP Session Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html) spells out the details:

- HttpOnly so scripts cannot read the session cookie (the cheat sheet calls this mandatory against session theft through XSS), Secure so it only travels over HTTPS, and SameSite as defense in depth against cross-site request forgery, not as a replacement for a CSRF check.
- Session IDs, JWTs and refresh tokens do not belong in localStorage or sessionStorage, because any script on the page can read them.
- The session ID must be regenerated whenever the privilege level changes, above all at sign-in, to prevent session fixation.
- An idle timeout and an absolute timeout, both enforced server-side, because a client can manipulate its own timers.
- Deleting the cookie in the browser does not invalidate a stolen copy. The session has to end on the server.

[MDN&#x27;s guide to cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies) adds a practical warning: a cookie without an expiry is deleted when the browser session ends, but browsers that restore sessions can keep it alive indefinitely. Closing the tab is not logging out.

[NIST SP 800-63B-4](https://pages.nist.gov/800-63-4/sp800-63b.html) puts numbers on it. At AAL2, the level that requires two factors, NIST says the overall reauthentication timeout should be no more than 24 hours and the inactivity timeout no more than 1 hour. At AAL3, 12 hours overall and 15 minutes of inactivity.

### Five session mistakes in self-built apps

**The session never ends.** A cookie set to last a year, or no server-side expiry at all. The login was strong once, and has not been asked for since.

**Logout only clears the browser.** The app deletes its cookie, but the server still accepts the old token. Anyone who copied it keeps access.

**The token sits where scripts can reach it.** A JWT in localStorage is convenient for a frontend. It is also readable by any injected script, a risk OWASP names explicitly.

**Leaving does not end anything.** The account is disabled at the identity provider, but the internal app has its own session that knows nothing about it. It keeps working until the cookie expires, which may be never.

**Every app does it differently.** Ten internal tools means ten session implementations, ten sets of cookie flags and ten logout buttons that may or may not work. Nobody can say where a colleague is still signed in.

### A practical baseline

1. One login for every internal app, from the identity provider the company already uses.
2. Session cookies with HttpOnly, Secure and SameSite, and a CSRF check on every change.
3. Sessions stored on the server, so they can be ended there.
4. The app itself never holds the session credential.
5. Switching somebody off ends every session they have, at once.
6. Links for outsiders expire by themselves and can be revoked.

### How cyantula solves this

cyantula is an internal app platform: an authenticating gateway plus a runtime, with your existing company login in front of every app. The session lives at that gateway, not in each app.

| Problem | How cyantula handles it |
| --- | --- |
| Every app does it differently | Sign-in goes through your company login (internal accounts, Google Workspace, Microsoft Entra ID, Smartschool, or any OpenID Connect or OAuth2 provider), so your password rules and two-step verification apply. Internal accounts require an authenticator app before the first session. No app builds its own login or session |
| The token sits where scripts can reach it | The session is a signed cookie with HttpOnly, Secure and SameSite set, and state-changing calls must pass an origin check against CSRF. The gateway removes the session cookie before a request reaches the app: the app gets verified identity headers and a short-lived signed identity token, never the credential itself |
| Logout only clears the browser | Sessions are stored in the database, so they can be revoked on the server, not just deleted in the browser |
| Leaving does not end anything | Somebody who can no longer sign in at your identity provider cannot sign in to the portal or any app. With people sync, cyantula switches them off without waiting for their next sign-in. Switching somebody off signs them out everywhere at once and revokes their tokens, and a reset of their sign-in also ends every session |
| Access outlives the decision | Every app is opened through the gateway, which checks the access list first. Share links for outsiders expire by themselves and can be revoked in one click, and switching share links off for the server ends every link already out there |

One more detail shows how far the separation goes. cyantula&#x27;s MCP endpoint for coding agents accepts bearer tokens only, never the browser session cookie, because published apps run on neighbouring addresses and could otherwise send that cookie along.

What cyantula does not do is fix the session handling inside an app that runs outside the platform. That app has to move behind the gateway first. Once it does, its homemade login can go, and its sessions follow the same rules as every other app.

cyantula is in early access in 2026, and we onboard the first teams by hand. Read [security and governance for IT](https://cyantula.app/docs/governance/) and [sign-in](https://cyantula.app/docs/settings/sign-in/), or start at [cyantula.app](https://cyantula.app).

### Sources

Related guide: [Access control for internal tools: login in front](https://cyantula.app/internal-tools-access-control/)
