Queries · q316 · Chief Information Security Officer · week 2, night 2
“The 9 churned tenants show 46-300 sessions per tenant that were never explicitly revoked — but are those sessions actually still usable today (expiry in the future), or did they just naturally expire without anyone bothering to revoke them?”
Fictional people at a fictional company, each played by a language-model agent. Who they are and what they are told
The manager, at the start of week 2
Subject: Re: Account security snapshot — good start, three gaps worry me more now
Noah,
This is a strong first week — thank you. The sign-in and access-governance findings give me confidence I can defend in a questionnaire. Three things genuinely surprised me and I want to understand them better before Friday's memo, plus one follow-up.
If we can only chase a couple of these deeply this week, I'd prioritize the deletion-audit scope (#1) and the churn-deactivation scope (#3) — those are the two a due-diligence team is most likely to ask us to prove, one way or the other.
Thanks, Henrik
The analyst · week 2, night 2, request 3 of 3
Night 1 reshapes the picture a lot. The 30-table census shows that products (615 rows, 91 tenants, 0% audit coverage) and users (39 rows, 69.2% coverage) are the ONLY two tables where a soft-delete has ever happened in three years — every other one of the 28 tables shows zero soft-deleted rows ever, so I can't test coverage there at all; this isn't evidence those tables are "fine," just that the question doesn't apply yet. That reframes #1 from "is it everywhere" to "it's concentrated in products, and separately, orders look terrible" — order cancellations matched an audit_log row only 0.2% of the time (3 of 1,712). But before I report that as a hard gap, I need to check the table built specifically for this — order_status_history — since generic audit_log missing it doesn't mean Tidewick has no record at all; that's tonight's top priority, since it could flip the finding. I also need to pin down the invoice-void result, which came back as "0 events" only because the engineer excluded void invoices with a null voided_at timestamp — I don't yet know if that's because no invoice has ever been voided, or because voided invoices exist but aren't timestamped (itself a data-quality finding). On #3, report 3 showed 100% of churned tenants' users are still "active" status and sessions were never explicitly revoked (46-300 per tenant) — but "never revoked" isn't the same as "still valid"; I need to check whether those sessions' expiry dates have actually lapsed before I can size the real exposure.
The engineer · 1 dry run on the empty schema, then the submission
select t.name as tenant_name, count(*) as never_revoked_sessions, count(*) filter (where s.expires_at > timestamp '2026-01-05 00:00:00') as still_within_expiry, count(*) filter (where s.expires_at <= timestamp '2026-01-05 00:00:00') as already_expired, max(s.expires_at) as latest_expires_at, max(s.last_seen_at) as latest_last_seen_at from sessions s join tenants t on t.id = s.tenant_id where t.status = 'churned' and s.revoked_at is null group by t.name order by still_within_expiry desc, tenant_name asc
“Query compiles cleanly with the right grain and columns.”
“Submitted. The report gives, per churned tenant: total never-revoked sessions, how many are still within their expiry window (the live risk) versus already expired on their own, plus the latest expires_at and last_seen_at among them — directly answering whether this is an exploitable risk or just stale bookkeeping.”
As Noah Fischer saw it, from the small dataset the agents worked on
tenant_name | never_revoked_sessions | still_within_expiry | already_expired | latest_expires_at | latest_last_seen_at -------------------+------------------------+---------------------+-----------------+----------------------------+--------------------------- Aurum & Ash | 73 | 0 | 73 | 2025-01-10 07:20:13.755243 | 2024-12-27 15:40:13.755243 Dewdrop Studio | 171 | 0 | 171 | 2025-10-23 09:44:11.78363 | 2025-10-09 17:45:11.78363 Halden Boots | 120 | 0 | 120 | 2025-10-17 08:05:13.116482 | 2025-10-03 09:55:13.116482 Klara Beauty | 110 | 0 | 110 | 2025-05-05 06:00:35.543369 | 2025-04-21 07:19:35.543369 Marginalia | 80 | 0 | 80 | 2025-06-27 06:55:24.418769 | 2025-06-13 11:25:24.418769 Northwire Audio | 191 | 0 | 191 | 2024-10-18 09:15:34.531675 | 2024-10-04 16:38:43.724015 Paddock & Pine | 46 | 0 | 46 | 2024-06-13 05:55:25.699322 | 2024-05-30 06:29:25.699322 Petal & Pestle | 223 | 0 | 223 | 2024-10-25 06:04:30.128982 | 2024-10-11 14:46:30.128982 Saltmarsh Knitwear | 300 | 0 | 300 | 2024-12-06 07:15:36.203341 | 2024-11-22 13:57:36.203341 (9 rows)
The memo and the queries that followed; links found by title, so inferred
It builds on:
Changed only where the benchmark needs the same result on every system
select t.name as tenant_name, count(*) as never_revoked_sessions, count(*) filter (where s.expires_at > timestamp '2026-01-05 00:00:00') as still_within_expiry, count(*) filter (where s.expires_at <= timestamp '2026-01-05 00:00:00') as already_expired, max(s.expires_at) as latest_expires_at, max(s.last_seen_at) as latest_last_seen_atfrom sessions sjoin tenants t on t.id = s.tenant_idwhere t.status = 'churned' and s.revoked_at is nullgroup by t.nameorder by still_within_expiry desc, tenant_name ascorder by still_within_expiry desc NULLS FIRST, tenant_name asc NULLS LAST
select t.name as tenant_name, count(*) as never_revoked_sessions, count(*) filter (where s.expires_at > timestamp '2026-01-05 00:00:00') as still_within_expiry, count(*) filter (where s.expires_at <= timestamp '2026-01-05 00:00:00') as already_expired, max(s.expires_at) as latest_expires_at, max(s.last_seen_at) as latest_last_seen_at from sessions s join tenants t on t.id = s.tenant_id where t.status = 'churned' and s.revoked_at is null group by t.name order by still_within_expiry desc NULLS FIRST, tenant_name asc NULLS LAST
The agents' own records, as the role play wrote them; only the personal data of the person who ran it is redacted
Report request from Noah Fischer (analyst for the Chief Information Security Officer): Title: Validity of never-revoked sessions on churned tenants Question: The 9 churned tenants show 46-300 sessions per tenant that were never explicitly revoked — but are those sessions actually still usable today (expiry in the future), or did they just naturally expire without anyone bothering to revoke them? Grain: one row per churned tenant Columns: - tenant name - sessions never revoked (revoked_at is null) - of those, still within expiry as of 2026-01-05 (expires_at > 2026-01-05, i.e. genuinely usable today) - of those, already naturally expired (expires_at <= 2026-01-05) - latest expires_at among never-revoked sessions - latest last_seen_at among never-revoked sessions (most recent real use) Details: Source: sessions joined to tenants where tenants.status = 'churned', filtered to revoked_at is null. Split by expires_at compared to the fixed reference date 2026-01-05 (no CURRENT_DATE per house standards). This tells us whether the 'never revoked' finding from last night is a live, exploitable risk (sessions still valid today) or a historical bookkeeping gap (sessions long since expired on their own). Order by 'still within expiry' descending, tenant name as tie-break. Expect 9 rows (one per churned tenant from the prior report). Check your query with the warehouse's dry_run tool, then hand it in with submit.
dry_runselect t.name as tenant_name, count(*) as never_revoked_sessions, count(*) filter (where s.expires_at > timestamp '2026-01-05 00:00:00') as still_within_expiry, count(*) filter (where s.expires_at <= timestamp '2026-01-05 00:00:00') as already_expired, max(s.expires_at) as latest_expires_at, max(s.last_seen_at) as latest_last_seen_at from sessions s join tenants t on t.id = s.tenant_id where t.status = 'churned' and s.revoked_at is null group by t.name order by still_within_expiry desc, tenant_name asc
STATUS: COMPILES (dry run on the empty schema, no data read) COLUMNS: tenant_name, never_revoked_sessions, still_within_expiry, already_expired, latest_expires_at, latest_last_seen_at
submitselect t.name as tenant_name, count(*) as never_revoked_sessions, count(*) filter (where s.expires_at > timestamp '2026-01-05 00:00:00') as still_within_expiry, count(*) filter (where s.expires_at <= timestamp '2026-01-05 00:00:00') as already_expired, max(s.expires_at) as latest_expires_at, max(s.last_seen_at) as latest_last_seen_at from sessions s join tenants t on t.id = s.tenant_id where t.status = 'churned' and s.revoked_at is null group by t.name order by still_within_expiry desc, tenant_name asc
Submitted to tonight's batch. Your work on this request is done.