xai / grok-4.7-efficient / low / low effort preferred over openai / gpt-6-luna / xhigh / xhigh effort · close win.
Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.
Reviewed public evidence
Task goal
Perform a source-grounded authorization and tenant-isolation review of review-pack access and worker-job token boundaries. Identify only a concrete cross-tenant, unauthorized-read/write, or token-confusion path supported by the code; give required preconditions, affected data/action, minimal mitigation, and regression coverage. Do not infer exploitability from names alone.
xai / grok-4.7-efficient / low / low effort answer
No closed cross-tenant exploit is fully proven inside this packet. The concrete unauthorized-read path the code will execute is unbounded serving of `ProcessingJob.output_path`. Worker-job tokens are not a review-pack credential in this snapshot.
## Finding
**Arbitrary storage read via job `output_path` (cross-tenant if that key is another tenant’s object).**
`GET /review-pack/{inspection_id}/in-progress/{file_path}`, `GET /review-pack/{inspection_id}/in-progress/fps-count`, and the unfinalized fallback in `GET /review-pack/{inspection_id}/{file_path}` authorize the inspection, then read storage from a job path that is not bound to the tenant or the inspection.
Evidence:
- Inspection access is tenant-scoped in `_get_inspection` (`review_pack.py` 1242–1273): `Asset.municipality_id == scope.own_org_id` and `scope.inspection_filter()`.
- The follow-up media lookup does not repeat that check (`2339–2344`, `2435–2439`, `4074–4079`): `MediaFile.inspection_id` + `media_type == "video"` + `active()` only. No `municipality_id`. `.first()` is unordered.
- The job lookup (`2353–2374`, `2446–2466`, `4084–4096`) filters `media_file_id`, job type, and status only. No `ProcessingJob.municipality_id`.
- The handler then serves `{job.output_path}/{file_path}` (`2378`, `2470–2474`, `4095–4121`) with path-traversal checks on `file_path` only. Unlike manifest `video_path` (`2656–2666`), there is no `_confine_to_pack_tenant`.
Affected action: read of whatever object exists at that key. In-progress routes are limited to `fps/` and `modules/observations/`. The generic route, when `review_pack_path` is empty, serves any non-`certification/` relative path, including `inspection.json` and track/video artifacts.
Required preconditions (all visible in this code once the row exists):
1. Caller passes `_get_inspection` for inspection `I`.
2. An active video `MediaFile` has `inspection_id == I`.
3. A `review_pack` or `embedded_import` job for that media id is `pending`, `running`, or `completed`, with non-empty `output_path`.
4. Generic route only: `inspection.review_pack_path` is empty. In-progress routes use `output_path` even when a finalized pack exists, if the requested file is missing there (`2424–2470`).
5. The storage backend has an object at `{output_path}/{file_path}`.
Cross-tenant consequence: if `output_path` is another municipality’s key (shared bucket, opaque keys), this handler returns those bytes. How `output_path` is written is outside the packet, so the write step is not established here. Given such a row, the read is unconditional.
Minimal mitigation: select media and job only when both `municipality_id` values equal `scope.own_org_id`, and reject `output_path` unless it matches a server-built prefix for that inspection (not merely “non-empty”). Do not treat a completed job’s `output_path` as a standing read capability.
Regression: inspection in org A, video media linked to it, job `output_path` under org B’s prefix, object present → 404 and no `storage.get`/`get_response`. Same for in-progress `fps/` and for generic `inspection.json` when `review_pack_path` is null. Control: same-inspection prefix still serves.
## Same-file gap (not cross-tenant by itself)
`serve_review_pack_video` (`2646–2666`) will read a worker-written manifest `video_path` if it only shares the first two segments of `pack_key` (`_confine_to_pack_tenant`, `1194–1208`). That blocks `review-packs/{other_muni}/...` if segment 2 is the municipality id. It does not block another inspection or project under `review-packs/{same_muni}/...`, even though `_get_inspection` applied `inspection_filter()`. Preconditions: no `video/*.mp4`, `{pack}/{video_path}` missing, relative `video_path` exists under that two-segment root. Mitigation: confine to the inspection pack key, not `parts[:2]`. Regression: same-muni, different inspection key → 404.
## Worker-token boundary
No token-confusion path into review-pack is shown. `_ALLOWED_ROUTES` (`78–93`) does not include `/review-pack`. `validate_worker_job_request` 403s before DB work when method/path miss (`207–216`). `sub` remains the uploader, but the fence is type + `scp == [WORKER_PACK_INGEST]` + live job/tenant/resource snapshot (`197–205`, `271–295`). Review-pack routes use `get_media_user` / `require_role` / `require_scope`, not these tokens.
`GET /api/v1/organizations/\d+/profile-bank/stats` is allowlisted without binding the path org id in this function. `enforce_worker_job_municipality` exists (`309–321`) but is not called here. Whether that route calls it is outside the packet; do not treat the route name as a confirmed bypass.
## Discarded
- `_inspection_json_asset_context` (`339–377`) uses a fresh session and omits municipality on `Asset.id` / `observation.inspection_id`. Those predicates are the already-authorized primary keys, so this is not a cross-tenant read by itself.
- `persist_review_boot_from_bytes` / `stamp_review_boot` (`155–208`) write boot JSON by `Inspection` id with no tenant or worker-job check. A foreign id would be a cross-tenant metadata write. No caller in this packet passes that id, so this is not a closed path.
- `serve_document` (`2523–2537`) omits `MediaFile.municipality_id` but still keys off the authorized `inspection_id` and serves that row’s `storage_key`. Cross-tenant only if such a mismatched row already exists; creation is not in this packet.
## Missing dependencies
`app.deps` (whether every non-`access` token hits `validate_worker_job_request`), profile-bank/observations/inspections handlers (whether they call `enforce_worker_job_*`), job-claim code that sets `output_path`, and storage/RLS behavior. Until those are in evidence, do not claim the worker fence is bypassed or that a worker can mint the bad `output_path`.
Next useful action: add the output_path confinement checks and the two regression tests above; separately confirm the org-id stats route calls `enforce_worker_job_municipality` before any tenant read.openai / gpt-6-luna / xhigh / xhigh effort answer
## Findings
1. **Conditional cross-tenant read through progressive review-pack serving.** `_get_inspection` scopes the inspection to the tenant (lines 1242–1273), but when no finalized pack path exists, the generic file route selects a `ProcessingJob` by media ID, type, and status—without checking its municipality (lines 4073–4097). It then serves the requested key under that job’s `output_path` (lines 4120–4121). The in-progress routes also select jobs without a tenant predicate (for example, lines 2433–2475).
**Preconditions:** An accessible tenant A inspection has no finalized pack, and a job referencing its media has tenant B’s `output_path` and readable objects. A tenant A user could then request a non-certification file under that path. The supplied evidence does not establish whether database constraints or job creation code make this mismatched association possible.
**Minimal mitigation and regression:** Require the job and linked media to match `scope.own_org_id` in every progressive-job query; verify the output path is tenant-scoped before storage access. Test that a mismatched job is not served to tenant A, while a correctly tenant-bound job still works.
2. **Conditional cross-tenant write in review-boot helpers.** `stamp_review_boot` and `persist_review_boot_from_bytes` load `Inspection` using only `inspection_id` (`review_boot.py`, lines 169–175 and 195–202), then write review-boot fields. A caller supplying another tenant’s inspection ID and pack bytes can update that row. These are internal helpers; the packet does not show whether an untrusted caller can supply those values.
**Minimal mitigation and regression:** Verify the inspection-to-pack/tenant association at the call boundary or in a tenant-aware helper. Test that a mismatched pack/inspection pair does not alter review-boot fields.
## Token-boundary assessment and uncertainty
The supplied worker-token code requires the expected token type’s job binding and scope, applies a method/path allowlist, checks the active job’s tenant and resource snapshot, and records worker-job state (`worker_job_tokens.py`, lines 193–306). However, the dependencies and endpoint call sites that resolve tenant scope and enforce resource bindings are outside the packet. **This evidence cannot establish whether those downstream checks are consistently applied**, so it does not support a confirmed worker-token bypass or token-confusion finding.
The key uncertainty is whether database constraints/job creation prevent cross-tenant job-to-media associations, and whether callers can mismatch review-boot inspection IDs and pack bytes. Neither is established by the supplied snapshot.
Primary judge's stated reason
Forced, weak preference for A: its inspection-specific confinement recommendation and more explicit regression expectations are slightly more useful for preserving resource authorization as well as tenant isolation. B's more disciplined conditional framing counterbalances that benefit. This is not an established material quality difference; an independent review could reasonably reject the preference.
This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.
Battle wave: 527c366a-0a3f-41a8-8ff5-f886f8eadb49. Pair: brp1_133eea58b08496fd94fa242dab8bbf051f5cd992c1ba9eb04935ab4856fac7e0. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.