session-management-test-authorlisted
Install: claude install-skill testland/qa
# session-management-test-author
## Overview
This build-an-X workflow authors tests for the session layer against
[OWASP ASVS V3 (Session Management)][asvs]: cookie attributes, timeout
behavior, session-ID regeneration, and logout semantics. Cite requirements
in the versioned form `v<version>-<chapter>.<section>.<requirement>` (e.g.,
`v5.0.0-1.2.5`) so assertions stay stable across releases.
[asvs]: https://owasp.org/www-project-application-security-verification-standard/
## When to use
- Authoring tests for any web app with sessions (cookie-based or
token-based).
- Reviewing PRs that touch login / logout / session middleware.
- A security audit cites ASVS V3 as a target.
- Compliance program (SOC 2, ISO 27001) requires evidence of
session-management testing.
## Step 1 - Cookie attribute baseline
Every session cookie MUST set:
| Attribute | Required value | Why |
|---|---|---|
| `Secure` | true (in production) | Prevents transmission over plaintext HTTP |
| `HttpOnly` | true | Prevents JavaScript access (XSS impact reduction) |
| `SameSite` | `Strict` or `Lax` | CSRF defense |
| `Path` | scope to app root or narrower | Limits cookie exposure |
| `Domain` | NOT a parent domain (avoid subdomain leak) | Limits cookie exposure |
| `Max-Age` or `Expires` | finite (absolute timeout) | Session can't outlive intended lifetime |
**Test pattern (Python with requests):**
```python
def test_session_cookie_has_all_required_attributes(client, base_url):
response = client.