🧪 Test Hub
testing: Demo target v3.0.0 · built-in demo site

DEMO-012 Freight: staff sign-in security checks

Edit Load test Duplicate

Signs in to the staff portal and verifies session rotation (no session fixation), that the dashboard refuses a browser with no session, and that signing out really ends the session.

authdemofreightsecurity version: 1.0 DEMO-012__freight_signin_security.py group: Freight regressiongroup: Freight smoke

Runs
15
Pass rate
87%
13 passed / 2 failed
Avg duration
2s
p95 2s
Estimate
2s
avg of last 10 judged runs
Flakiness
0.29
0 stable · 1 alternates
Current streak
8
passed

Last 15 results newest on the right — click a square to open that run

Duration per run point color = outcome; dashed = 7-run average; click a point to open the run

Step timing trends the same step compared across the last 15 runs — slowest steps first, one line each

How long it takes distribution of 15 runs — two humps mean two different behaviours hiding behind one average

fastest 1s · slowest 2s

Why this test failed grouped by message, last 90 days

timesmessagelast
2 AssertionError: session fixation: the session id did not change at si… Sep 24 open

Outcomes by target version

What this test does plain language, derived from the code

  1. site = Freight(page, ctx).open("login/")
  2. before = _session_id(page)
  3. with ctx.logging_in():
  4. Type “tester” into #username
  5. page.fill("#password", ctx.secret(PASSWORD_SECRET, DEFAULT_PASSWORD))
  6. Click #login-btn
  7. Wait until #signed-in-user appears
  8. after = _session_id(page)
  9. Take a screenshot (“signed-in”)
  10. assert before and after, "the site set no session cookie at all"
  11. assert after != before, (
  12. "session fixation: the session id did not change at sign-in, so anyone "
  13. "who knew the old id now holds a signed-in staff session")
  14. ctx.check_protected_page() # the dashboard we just landed on
  15. with ctx.logging_out():
  16. site.sign_out()
  17. page.goto(site.url("ops/"))
  18. assert "/login/" in page.url, (
  19. f"after signing out, the staff portal should send us to sign-in; "
  20. f"it showed {page.url}")
Show the code
"""Staff sign-in, and the three session checks that matter.

  ctx.logging_in()           the session id must CHANGE at sign-in; if it
                             does not, whoever knew the old id now holds a
                             signed-in session (session fixation). This test
                             also asserts it outright, so a release that loses
                             the rotation FAILS here instead of only showing up
                             on the Security page.
  ctx.check_protected_page() the dashboard, fetched from a brand-new browser
                             with no cookies, must NOT come back 200.
  ctx.logging_out()          the old session cookie, replayed after sign-out,
                             must no longer work.

None of this attacks anything: it watches a flow the site performs anyway.
The password comes from Settings -> Credentials ("demo_password") when set.
"""
from _lib.freight import DEFAULT_PASSWORD, PASSWORD_SECRET, Freight


def _session_id(page):
    for cookie in page.context.cookies():
        if cookie["name"] == "sessionid":
            return cookie["value"]
    return ""


def run(page, ctx):
    site = Freight(page, ctx).open("login/")
    before = _session_id(page)

    with ctx.logging_in():
        page.fill("#username", "tester")
        page.fill("#password", ctx.secret(PASSWORD_SECRET, DEFAULT_PASSWORD))
        page.click("#login-btn")
        page.wait_for_selector("#signed-in-user")
    after = _session_id(page)
    ctx.screenshot("signed-in")

    assert before and after, "the site set no session cookie at all"
    assert after != before, (
        "session fixation: the session id did not change at sign-in, so anyone "
        "who knew the old id now holds a signed-in staff session")

    ctx.check_protected_page()           # the dashboard we just landed on

    with ctx.logging_out():
        site.sign_out()

    page.goto(site.url("ops/"))
    assert "/login/" in page.url, (
        f"after signing out, the staff portal should send us to sign-in; "
        f"it showed {page.url}")

All runs

RunStatusQueuedDuration VersionTriggerBatch
#487 passed 2026-09-25 07:00:10 2s 3.0.0 schedule schedule: Freight regression …
#394 passed 2026-09-24 23:24:12 2s 3.0.0 group group: Freight smoke
#390 passed 2026-09-24 23:23:58 2s 3.0.0 group group: Freight smoke
#386 passed 2026-09-24 23:22:20 2s 3.0.0 group group: Freight smoke
#382 passed 2026-09-24 23:10:27 2s 3.0.0 group group: Freight smoke
#375 passed 2026-09-24 22:10:14 2s 3.0.0 schedule schedule: Freight smoke 22:10
#367 passed 2026-09-24 22:05:21 2s 3.0.0 group group: Freight regression
#357 passed 2026-09-24 22:04:30 2s 3.0.0 group group: Freight smoke
#353 failed 2026-09-24 22:04:21 2s 2.1.0 group group: Freight smoke
#333 passed 2026-09-24 19:48:13 2s 3.0.0 cli-adopted 4 tests (terminal)
#309 passed 2026-09-24 18:59:58 2s 3.0.0 cli-adopted 8 tests (terminal)
#301 failed 2026-09-24 18:57:59 1s 2.1.0 cli-adopted 8 tests (terminal)
#289 passed 2026-09-24 18:55:40 2s 2.0.0 cli-adopted 8 tests (terminal)
#150 passed 2026-09-24 18:52:00 2s 1.1.0 cli-adopted 8 tests (terminal)
#12 passed 2026-09-24 18:48:19 2s 1.0.0 cli-adopted 8 tests (terminal)