본문으로 건너뛰기
cccskills
무료GitHub에 공개

session-management-test-author

Build-an-X for session management tests per OWASP ASVS V3 - cookie attribute coverage (Secure / HttpOnly / SameSite=Strict|Lax), session-fixation defense (regenerate session ID on login), absolute + idle timeout, concurrent-session limits, logout invalidation across devices, CSRF token handling, session-binding to TLS / IP / device fingerprint. Use when authoring tests for any web app's session layer, regardless of framework (Express session, Django sessions, Spring Security, ASP.NET, Rails, etc.).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa스타 13(GitHub 13 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(13)

  • SKILL.md9.5 KB
  • .tessl-plugin/plugin.json650 B
  • evals/an-api-key-revoked-by-a-link-nobody-meant-to-click/criteria.json5.7 KB
  • evals/an-api-key-revoked-by-a-link-nobody-meant-to-click/task.md9.9 KB
  • evals/clinician-sessions-that-have-been-open-for-weeks/criteria.json5.3 KB
  • evals/clinician-sessions-that-have-been-open-for-weeks/task.md7.3 KB
  • evals/marketing-wants-the-session-cookie-on-the-blog-subdomain/criteria.json6.3 KB
  • evals/marketing-wants-the-session-cookie-on-the-blog-subdomain/task.md7.4 KB
  • evals/set-cookie-on-login-mistaken-for-regeneration/criteria.json5.8 KB
  • evals/set-cookie-on-login-mistaken-for-regeneration/task.md9.8 KB
  • evals/stolen-laptop-and-the-sign-out-everywhere-button/criteria.json6.0 KB
  • evals/stolen-laptop-and-the-sign-out-everywhere-button/task.md8.3 KB
  • references/session-test-patterns.md2.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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:

AttributeRequired valueWhy
Securetrue (in production)Prevents transmission over plaintext HTTP
HttpOnlytruePrevents JavaScript access (XSS impact reduction)
SameSiteStrict or LaxCSRF defense
Pathscope to app root or narrowerLimits cookie exposure
DomainNOT a parent domain (avoid subdomain leak)Limits cookie exposure
Max-Age or Expiresfinite (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 invalidated. Bonus: server-side invalidation (vs just clearing the cookie client-side) prevents replay.

Test pattern:

def test_logout_server_side_invalidation(client, base_url):
    client.login("alice", "alicepass")
    cookie_value = client.cookies.get("sessionid")
    client.post(f"{base_url}/logout")

    # Replay the cookie value:
    response = requests.get(
        f"{base_url}/dashboard",
        cookies={"sessionid": cookie_value},
    )
    assert response.status_code == 401

If the replay succeeds, the server is only clearing the client cookie - critical finding for high-security apps.

Multi-device "logout from all devices" pattern: references/session-test-patterns.md.

Step 6 - CSRF token handling

For cookie-based sessions, every state-changing endpoint should require a CSRF token (or use SameSite=Strict cookies, which provides similar guarantees).

Test pattern:

def test_csrf_token_required(client, base_url):
    client.login("alice", "alicepass")
    # Request without CSRF token
    response = client.post(f"{base_url}/transfer", json={"to": "bob", "amount": 100})
    assert response.status_code in [403, 419]   # CSRF rejection

def test_csrf_token_per_session(client, base_url):
    client.login("alice", "alicepass")
    # Get the CSRF token via the standard endpoint
    csrf_response = client.get(f"{base_url}/api/csrf")
    token = csrf_response.json()["token"]

    response = client.post(
        f"{base_url}/transfer",
        json={"to": "bob", "amount": 100},
        headers={"X-CSRF-Token": token},
    )
    assert response.status_code == 200

Step 7 - Session binding (defense-in-depth)

For high-security apps, bind sessions to additional context.

Default: User-Agent + device-fingerprint binding - strikes the best balance of attack surface reduction vs. false positives on legitimate user activity. Use TLS binding (RFC 8473) when the deployment controls both client and server and requires maximum strength; use IP binding only when the threat model accepts mobile-network churn (frequent re-auth on roaming).

These are policy decisions; the test verifies the chosen binding holds (e.g., a request replaying the cookie under a different User-Agent gets 401). Pattern: references/session-test-patterns.md.

Step 8 - End-to-end test recipe

For each app's session layer:

  1. ✅ Cookie attributes (Step 1)
  2. ✅ Session-fixation defense (Step 2)
  3. ✅ Idle timeout (Step 3)
  4. ✅ Absolute timeout (Step 3)
  5. ✅ Concurrent-session policy enforced (Step 4)
  6. ✅ Logout = server-side invalidation (Step 5)
  7. ✅ Logout-all-devices works (Step 5)
  8. ✅ CSRF token required for state-changing endpoints (Step 6)
  9. ✅ Session binding per threat model (Step 7)

Anti-patterns

Consolidated with the extended patterns in references/session-test-patterns.md.

Limitations

  • This is a build-an-X workflow targeting cookie-based sessions primarily. JWT-based stateless sessions have a different attack-surface model - see oauth-flow-test-author.
  • ASVS V3 evolves per major version (current: v5.0.0); cite the pinned version in your test assertions.
  • Some defenses (TLS binding, device fingerprinting) require server
    • client coordination; tests verify the server side; client conformance is separate.
  • Federated SSO sessions (Keycloak / Auth0 / Okta) layer their own session-management on top - see those skills for IdP-specific patterns.

References

  • asvs - OWASP ASVS landing
  • owasp.org/www-project-cheat-sheets/cheatsheets/Session_Management_Cheat_Sheet - OWASP Session Management Cheat Sheet (companion to ASVS V3)
  • IETF RFC 6265 - HTTP State Management Mechanism (cookies)
  • IETF RFC 8473 - Token Binding over HTTP
  • developer.mozilla.org/en-US/docs/Web/HTTP/Cookies - MDN cookie reference
  • oauth-flow-test-author - companion: pre-session auth flow
  • keycloak-tests, auth0-tests, okta-tests - IdP-specific session patterns (federated SSO)

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Builds a CI gate that fails the build on **new** WCAG / a11y violations introduced by a PR while grandfathering pre-existing violations on a per-rule / per-page baseline. Aggregates verdicts from axe-core / pa11y / Lighthouse a11y / WAVE / IBM Equal Access scans. Use when a project has accumulated a11y debt and a strict "zero violations" gate would block every PR - the ratchet pattern lets the team ship while preventing regressions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Workflow skill that builds an A/B-test validity checklist from an experiment proposal, walking the canonical design-correctness gates - pre-registered OEC/power/guardrails, randomization unit + SRM check, assignment integrity, telemetry, peeking discipline, novelty/primacy, post-experiment SRM re-check - into a per-experiment checklist + sign-off form. Use when launching, auditing, or governing an experiment. For pitfall mechanics (guardrails, peeking) see experiment-results-interpreter's references; to read an already-valid result use experiment-results-interpreter; for per-SDK harness tests use experiment-sdk-testing - this gates DESIGN, not SDK code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

The single install-flow skill: the reference contract for the PWA install flow (installability gate fields, `beforeinstallprompt` handshake, per-platform paths - Android WebAPK / iOS Share menu / Firefox no-op - and the `display-mode` post-install signal, in references/install-flow-reference.md) plus the build-an-X workflow that emits the Add-to-Home-Screen suite. Walks the four-stage timeline, emitting one test per gate cell per [web.dev/articles/install-criteria][install-criteria], the deferred-prompt → `prompt()` → `userChoice` chain per [web.dev/articles/customize-install][customize-install], the iOS Safari manual-metadata branch (`apple-touch-icon`) per [web.dev/learn/pwa/installation][learn-pwa], and the post-install `(display-mode: standalone)` MQ assertion. Output: a Playwright spec with per-stage cells plus a coverage matrix. Use when a PWA's manifest, icons, or install handler change, when install conversion drops at an unknown stage, or when triaging a flaky install assertion.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Build-an-X workflow that uses an LLM to map existing tests to spec sections - given a spec doc + the test suite, the LLM identifies which tests cover which sections, surfaces uncovered sections (gap), and recommends specific tests to add. Output is a coverage matrix per spec ID. Scope is mapping tests that already exist and naming the gaps, not authoring tests for new acceptance criteria. Use when a spec doc and a test suite both exist but nobody can say which requirements are actually covered - before a release sign-off, an audit, or a decision about where to spend the next round of test effort.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Generates tests from natural-language specs (acceptance criteria, user stories, requirements) using an LLM, with confidence scoring per test case (LLM self-assessment plus heuristics: assertion quality, naming, completeness), batching uncertain cases for human review, and integration with the team's existing test framework. Use when the user asks to generate unit tests from acceptance criteria, convert user stories to test cases, automate test creation from requirements, or augment a spec-driven test suite with AI-generated stubs that are then curated before merge.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Configures Allure Report (test-runner adapter install, `allure-results` directory wiring, `categories.json` for failure classification, `history-trend.json` retention via the copy-history-between-runs pattern), runs the Allure CLI to convert `allure-results` to a static HTML site, and uploads the report as a CI artifact. Use when the team needs richer test reporting than JUnit XML - step-level attachments, per-test history, retry tracking, and severity / epic / feature labeling across framework-agnostic adapters (pytest, Jest, JUnit, TestNG, NUnit, Mocha). As a rich static HTML report generator, it is the open-source alternative to the sunset ExtentReports (JVM/.NET per-test HTML narrative); for hosted cross-run flakiness analytics rather than a static per-run report use currents-integration.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

testland의 스킬 모두 보기

이 스킬의 문제 신고