Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

session-management-test-author

БесплатноБез исполняемых скриптовНе проверен

Use for any question or task about testing sessions, login or logout security in a web app, in any framework, including one login handler and old cookies that…

testlandот testland★ 18 звёзд на GitHub

Об этом скилле

session-management-test-author

Overview

This build-an-X workflow authors tests for the session layer against OWASP ASVS V3 (Session Management): 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.

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):

def test_session_cookie_has_all_required_attributes(client, base_url):
    response = client.post(f"{base_url}/login", data={"user": "alice", "pass": "alicepass"})

    set_cookie = response.headers.get("Set-Cookie", "")
    assert "Secure" in set_cookie
    assert "HttpOnly" in set_cookie
    assert "SameSite=Strict" in set_cookie or "SameSite=Lax" in set_cookie
    assert ("Max-Age" in set_cookie) or ("Expires" in set_cookie)

    # Domain attribute should NOT include parent domain:
    if "Domain=" in set_cookie:
        domain = set_cookie.split("Domain=")[1].split(";")[0]
        assert not domain.startswith(".")   # no leading-dot (parent domain)

Default: SameSite=Strict - provides the strongest CSRF defense by blocking the cookie on all cross-site requests. Use SameSite=Lax only when the session must survive OAuth callback redirects or other top-level cross-site navigations.

Step 2 - Session-fixation defense

When a user logs in, the session ID MUST change. Otherwise an attacker who set a known session ID on the victim's browser can hijack the post-login session.

Test pattern:

def test_session_id_regenerates_on_login(client, base_url):
    # Pre-login: visit homepage, get session cookie
    pre_login = client.get(f"{base_url}/")
    sid_before = parse_cookie(pre_login, "sessionid")

    # Login (carry the pre-login cookie)
    client.post(
        f"{base_url}/login",
        data={"user": "alice", "pass": "alicepass"},
        cookies={"sessionid": sid_before},
    )

    # Post-login: session ID must differ
    sid_after = parse_cookie(client.get(f"{base_url}/dashboard"), "sessionid")
    assert sid_after != sid_before

If the test fails (session ID unchanged), mark critical: session-fixation vulnerability.

Step 3 - Absolute + idle timeout

Two timeout dimensions:

  • Absolute timeout: maximum session lifetime regardless of activity (e.g., 8 hours). Common for high-security apps.
  • Idle timeout: session expires after N minutes of inactivity (e.g., 30 minutes).

Either alone is insufficient - both should be enforced.

Test pattern:

def test_idle_timeout(client, base_url, freezer):
    freezer.move_to("2026-05-06 09:00:00")
    client.login("alice", "alicepass")

    # Activity 5 minutes later: still works
    freezer.tick(timedelta(minutes=5))
    assert client.get(f"{base_url}/dashboard").status_code == 200

    # No activity for 31 min: should expire
    freezer.tick(timedelta(minutes=31))
    response = client.get(f"{base_url}/dashboard")
    assert response.status_code == 401   # or redirects to login

def test_absolute_timeout(client, base_url, freezer):
    freezer.move_to("2026-05-06 09:00:00")
    client.login("alice", "alicepass")

    # Continuous activity should NOT extend beyond absolute limit
    for _ in range(8 * 6):    # 8 hours of activity, 10-min intervals
        freezer.tick(timedelta(minutes=10))
        client.get(f"{base_url}/dashboard")

    # 8h elapsed: even with continuous activity, session expires
    freezer.tick(timedelta(minutes=1))
    assert client.get(f"{base_url}/dashboard").status_code == 401

Step 4 - Concurrent-session limits

Some apps cap concurrent sessions (e.g., banking apps to 1): either the older session is revoked or the second login is rejected. Document the policy, then test it - pattern in references/session-test-patterns.md.

Step 5 - Logout invalidation across devices

When a user logs out from one device, all their sessions on that device must be inva

Полный SKILL.md на GitHub

Установить session-management-test-author в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.tessl-plugin/plugin.jsonevals/an-api-key-revoked-by-a-link-nobody-meant-to-click/criteria.jsonevals/an-api-key-revoked-by-a-link-nobody-meant-to-click/task.mdevals/clinician-sessions-that-have-been-open-for-weeks/criteria.jsonevals/clinician-sessions-that-have-been-open-for-weeks/task.mdevals/marketing-wants-the-session-cookie-on-the-blog-subdomain/criteria.jsonevals/marketing-wants-the-session-cookie-on-the-blog-subdomain/task.mdevals/set-cookie-on-login-mistaken-for-regeneration/criteria.jsonevals/set-cookie-on-login-mistaken-for-regeneration/task.mdevals/stolen-laptop-and-the-sign-out-everywhere-button/criteria.jsonevals/stolen-laptop-and-the-sign-out-everywhere-button/task.mdreferences/session-test-patterns.md

FAQ

Что делает скилл session-management-test-author?

Use for any question or task about testing sessions, login or logout security in a web app, in any framework, including one login handler and old cookies that still work after logout: cookie flags (Secure, HttpOnly, SameSite), session ID regeneration on login, idle and absolute timeouts, concurrent-session limits, logout on all devices, CSRF tokens and session binding, per OWASP ASVS V3.

Как установить скилл session-management-test-author?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл session-management-test-author запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить session-management-test-author с