Skip to content

[codex] Fix agent check-in PII access - #1995

Merged
stefan-burke merged 9 commits into
mainfrom
work/security-finding-1-agent-checkin
Jul 31, 2026
Merged

[codex] Fix agent check-in PII access#1995
stefan-burke merged 9 commits into
mainfrom
work/security-finding-1-agent-checkin

Conversation

@stefan-burke

Copy link
Copy Markdown
Member

What changed

Delivery-agent sessions now filter GET /checkin/:tokens entries through the same delivery assignment rules used by the run sheet before attendee details are decrypted.

Agents can still view check-in details for bookings assigned to one of their logistics agents for today or tomorrow. They now get a forbidden response when every token is outside that scope. If a mixed token URL contains both allowed and disallowed bookings, only the allowed rows are shown.

The agent check-in view no longer renders staff-only admin links or check-in forms. Owner and manager check-in behavior stays unchanged. Public unauthenticated check-in behavior also stays unchanged.

Why

The check-in GET route treated any signed-in admin session as allowed to decrypt every token in the URL. Delivery agents could therefore open a valid token for an unrelated attendee and read their personal details.

Validation

  • nix develop -c deno task test:files test/ui/templates/checkin/rendering.test.ts test/shared/db/logistics.test.ts test/ui/templates/attendee-table/columns/table-definition.test.ts
  • nix develop -c deno task precommit

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 933eec6f-0d2b-417a-9446-13ed4370fdeb

📥 Commits

Reviewing files that changed from the base of the PR and between dcc596e and 9bc523b.

📒 Files selected for processing (26)
  • .gitignore
  • TODO.md
  • deno.json
  • flake.nix
  • src/features/admin/deliveries.ts
  • src/features/checkin.ts
  • src/features/tickets/token-utils.ts
  • src/shared/db/attendees/queries.ts
  • src/shared/db/logistics-run-sheet.ts
  • src/shared/db/logistics.ts
  • src/shared/db/query.ts
  • src/ui/templates/admin/attendee-table-block.tsx
  • src/ui/templates/attendee-table/columns.tsx
  • src/ui/templates/attendee-table/component.tsx
  • src/ui/templates/attendee-table/types.ts
  • src/ui/templates/checkin.tsx
  • test/integration/no-quantity-audit.test.ts
  • test/shared/db/logistics.test.ts
  • test/shared/db/logistics/runsheet.test.ts
  • test/test-utils/factories.ts
  • test/test-utils/logistics.ts
  • test/ui/templates/attendee-table/columns/table-definition.test.ts
  • test/ui/templates/checkin/auth.test.ts
  • test/ui/templates/public/reservations/ticket-page/date-location-and-grouping.test.ts
  • test/ui/templates/public/shared.test.ts
  • test/ui/templates/tickets/view-page.test.ts

Comment @coderabbitai help to get the list of available commands.

@stefan-burke
stefan-burke marked this pull request as ready for review July 30, 2026 08:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 371d5dfa52

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/checkin.ts Outdated
@stefan-burke
stefan-burke changed the base branch from codex-security-deno-script to main July 30, 2026 12:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b630a928f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/args.ts Outdated
Comment thread flake.nix Outdated
The agent check-in filter reduced every entry to its (attendee, listing)
pair, so an attendee booked twice on the same listing (different dates
or package paths) leaked every matching row when only one row's leg was
on the agent's run sheet — Codex review on PR #1995.

getAgentRunSheetBookings now returns each matched row's full slot
identity (attendee + listing + start_at date + parent_listing_id +
package_group_id) and the check-in filter compares each entry against
that set with the same key, so a sibling row outside the run sheet
never appears.

The TokenEntry type now carries parentListingId, completing the unique
slot identity alongside attendee.id, listing.id, attendee.date, and
attendee.package_group_id — the dimensions a listing_attendees row is
uniquely indexed on. A new testTokenEntry factory consolidates the
parent-listing default so token-entry fixtures in three view test files
pick it up once.

Drop the dead `equals: true` branch from scripts/args.ts: codex-security
was its only caller, and the option is gone.

Add a multi-row regression at the unit layer
(test/shared/db/logistics.test.ts) and at the HTTP layer
(test/ui/templates/checkin/rendering.test.ts) — the HTTP test fails
against the old filter (row B's quantity and date leak into the page)
and passes with this change.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 561dd1dccc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/shared/db/logistics.ts Outdated
Comment thread test/ui/templates/checkin/rendering.test.ts Outdated
Comment thread TODO.md Outdated
Comment thread test/shared/db/logistics.test.ts Outdated
- Drop orphaned codex-security Python (tomli + shell-hook export) from
  flake.nix; the scanner that needed it was deleted in b630a92.
- Split src/shared/db/logistics.ts (459 lines) into logistics.ts (assignment
  reads/writes, 162 lines) and logistics-run-sheet.ts (run-sheet access and
  the agent check-in filter's row-identity query, 305 lines). Callers of
  run-sheet exports (checkin.ts, deliveries.ts, runsheet.test.ts,
  no-quantity-audit.test.ts) now import from logistics-run-sheet.ts.
- Split test/ui/templates/checkin/rendering.test.ts (412 lines) into
  rendering.test.ts (256 lines) and auth.test.ts (164 lines), extracting the
  role-authorization tests (delivery-agent cross-booking, multi-row
  regression, editor cannot decrypt) into their own focused suite.
- Remove 'work/security-finding-1-agent-checkin' from TODO.md's active-jobs
  list — that work shipped on PR #1995.
- Strip review-history prose from the multi-row regression tests; keep only
  the short explanation the fixture needs.
@stefan-burke
stefan-burke added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit 09e47fd Jul 31, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the work/security-finding-1-agent-checkin branch July 31, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant